I am having a bit of difficulty making sure a sound (for new email notification for eg) is heard. It seems to work in google chrome, but not on mobile devices, ipad and it seems other programs on the computer could affect playback . this is what i have. what would you suggest? thanks.
I call this function after the page refreshes and a db query checks for any unread messages. Thanks for any assistance..
Code: Select all
<script type="text/javascript">function refreshPage(){setTimeout('window.location.href=window.location.href',60000);}</script>
<script language="javascript" type="text/javascript">
function play_sound() {
var audioElement = document.createElement('audio');
audioElement.setAttribute('src', 'music/ding.mp3');
audioElement.setAttribute('autoplay', 'autoplay');
audioElement.load();
audioElement.play();
}
function Delay_sound() {
setTimeout("play_sound()", 45000);
}
</script>