Monroe406
asked on
Javascript global variable only recognizable using Microsoft browsers--not with other browsers
I am trying to figure out why the following code works with Microsoft browsers (IE / Edge) but not with any other web browser. Does anyone have any ideas?
<html>
<head>
<script type="text/javascript">
var URL='http://www.noiseaddicts.com/samples_1w72b820/3718.mp3';
</script>
</head>
<body>
<audio controls>
<source id="desktop1" src="" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<script type="text/javascript">
window.onload=function(){
document.getElementById('desktop1').setAttribute('src', URL);
};
</script>
</body>
</html>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window