I know we can use AJAX to change page area so the page is not closed (then audio will not stop), but what if I pressed the refresh button? I have Googled a lot but didn't find a solution.
This is possible, because Jamendo has implemented this feature (Even in the refreshing process, the music continues playing).
We can prevent the refresh of the page using the F5 button using Javascript.
if ((e.which || e.keyCode) == 116) e.preventDefault();
[update]
The above works great but regarding the browser refresh button and CTRL + R I've just confirmed the following will force a pop-up to the user to confirm they want to leave.
window.onbeforeunload = function () {return false;}
Why not just use AJAX?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With