So, I have an if statement in my javascript. When it returns true, it opens a warning window and plays a sound. The problem is that the sound does not play until I press the ok button.
Here is the relevant information:
if (x > 10) { var snd = new Audio('/alarm.mp3'); snd.play(); alert("Thank you!"); }
Ideally, I want the sound to last about 6 seconds, until it is at the end or until the user hits, closes from the dialog box. But actually receiving a sound signal before closing the notification window would be good enough.
source share