Created
October 10, 2013 08:58
-
-
Save Ruxton/6915262 to your computer and use it in GitHub Desktop.
Confirm bandcamp window close if playing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.onbeforeunload = function () { | |
var shouldConfirmClose = ($('.playing').length > 0); //get boolen value | |
if (shouldConfirmClose) { | |
//this will alert user | |
return 'Are you sure?'; | |
} | |
else { | |
//this wont | |
window.onbeforeunload = undefined; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment