Clicking this bookmarklet on a browser tab will cause the above alert to display when you try to close it. Handy if you have work you really don't want to lose.
Last active
November 28, 2018 04:41
-
-
Save benknight/13595bdd49a6b87c6d24 to your computer and use it in GitHub Desktop.
Before Unload Bookmarklet
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
javascript:window.addEventListener%28%22beforeunload%22%2C%20function%20%28e%29%20%7B%20var%20confirmationMessage%20%3D%20%22o/%22%3B%20%28e%20%7C%7C%20window.event%29.returnValue%20%3D%20confirmationMessage%3B%20return%20confirmationMessage%3B%20%7D%29%3B |
I'll strike a compromise with you and change it to: "to lose"! Thanks ;)
This is a lifesaver. I often load a ton of tweets into my Twitter timeline, and then accidentally click on a link to another page.
How to use this? Where i need to paste the code?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
"work you really don't want to use" => I tkink you meant "to loose".