How do I autostart background music in Safari and stop it via javascript?
I tried setting the data to a false mp3 but it does not seem to work in Safari (on Windows) it only works in FireFox. (Internet Explorer does not even play the mp3.)
Here is HTML:
<OBJECT ID="BackgroundMusic" DATA="music/background.mp3" TYPE="audio/mpeg" height="0" width="0">
<PARAM NAME="autostart" VALUE="true">
<PARAM NAME="hidden" VALUE="true">
</OBJECT>
<p class="music" onClick="StopBackgroundMusic()">Stop Music</p>
Here is javascript
function StopBackgroundMusic()
{
var MusicObj = document.getElementById("BackgroundMusic");
MusicObj.data = "nothing.mp3";
MusicObj.autoplay = "false";
MusicObj.autostart = "false";
}
I tried setting the data to a false mp3 but it does not seem to work in Safari (on Windows) it only works in FireFox. (Internet Explorer does not even play the mp3.)
Here is HTML:
<OBJECT ID="BackgroundMusic" DATA="music/background.mp3" TYPE="audio/mpeg" height="0" width="0">
<PARAM NAME="autostart" VALUE="true">
<PARAM NAME="hidden" VALUE="true">
</OBJECT>
<p class="music" onClick="StopBackgroundMusic()">Stop Music</p>
Here is javascript
function StopBackgroundMusic()
{
var MusicObj = document.getElementById("BackgroundMusic");
MusicObj.data = "nothing.mp3";
MusicObj.autoplay = "false";
MusicObj.autostart = "false";
}