Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
window.addEventListener('beforeunload', function (e) {
// Cancel the event
// Chrome requires returnValue to be set
e.returnValue = '';
// This message may not be shown to the user / vendor specific message may be used...
window.confirm("Are you sure?");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.