I use the following script to play 2 sound files after a timedelay
<html>
<head>
<script language="javascript" type="text/javascript">
function playSound(soundfile,soundfile1)
{
document.getElementById("sound").innerHTML= "<embed src=\""+soundfile+"\" hidden=\"true\" autostart=\"true\" loop=\"true\" />";
setTimeout(function(){document.write ('<EMBED src= "' + soundfile1 + '" hidden=true autostart=true loop=false>')},2000);
setTimeout(function(){alert("You have successfully launched the MedOrient website! \n Thank you for launching Sri sai medical jobs.");},3000);
setTimeout("window.location='http://url'",8000);
}
</script>
</head>
<body>
<a href="#" onclick="playSound('clapping.mp3','fireworks56.mp3');" ><img src="ribbon-cutting.jpg"/></a>
</body>
</html>
This is working in Chrome, but is not working in firefox or IE.
The soundfile1(fireworks56.mp3) plays after few(approx. 8) seconds, but it does not redirect.
In the firefox status bar it shows,
Read http://url
Don’t use
document.writethat will overwrite the page with new content.Try below code, I changed
document.writeand assigned the value todocument.getElementById("sound").innerHTML