Reputation: 1362
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).
Upvotes: 3
Views: 1356
Reputation: 3141
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?
Upvotes: 1