Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<script>
window.addEventListener('beforeunload', function (e) {
// Cancel the event
e.preventDefault();
// 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?");
});
</script>
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.