-
-
Save Noitidart/e898a84a4f72e1b4c11ff7ca11a46bf7 to your computer and use it in GitHub Desktop.
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
var leaveCnt = 0; | |
window.addEventListener("beforeunload", function (event) { | |
leaveCnt++ | |
if (leaveCnt === 1) return; | |
else event.returnValue = 'Are you sure?' | |
console.log('event:', event); | |
event.returnValue = 'asdf'; // JSON.stringify(event); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment