Created
November 20, 2014 12:51
-
-
Save kanakiyajay/659b46aa49cd278ab8c9 to your computer and use it in GitHub Desktop.
javascript snippet to alert user from not leaving
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 (e) { | |
e = e || window.event; | |
// For IE and Firefox prior to version 4 | |
if (e) { | |
e.returnValue = 'Sure?'; | |
} | |
// For Safari | |
return 'Sure?'; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment