Created
February 17, 2015 17:21
-
-
Save akornmeier/d01a8bd7daf6b6a3296b to your computer and use it in GitHub Desktop.
Crossbrowser prevent page from reloading
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.addEventListener("beforeunload", function (e) { | |
var confirmationMessage = "\o/"; | |
(e || window.event).returnValue = confirmationMessage; // Gecko and Trident | |
return confirmationMessage; // Gecko and WebKit | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment