Trying to get a button to refresh the page only after the sound stops playing.
I have tried the onend
event but without success.
function play() {
var audio = document.getElementById("audio");
audio.play();
}
function myFunction() {
location.reload(1);
}
<button onclick="myFunction()">Reload page</button>
<img src="./images/play.png" value="PLAY" onclick="myFunction();play()">
<audio id="audio" src="./Sounds/Casino4.wav"></audio>
Play button currently only refreshes the page but you can hear the sound starting, but the page refreshes before it stops.