Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
cancelable `beforeunload` event example
// by
window.addEventListener("beforeunload", function (event) {
event.preventDefault(); // Cancel the event as stated by the standard.
event.returnValue = ''; // Chrome requires returnValue to be set.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment