Skip to content

Instantly share code, notes, and snippets.

@twinge
Created October 16, 2013 00:59
Show Gist options
  • Save twinge/7001048 to your computer and use it in GitHub Desktop.
Save twinge/7001048 to your computer and use it in GitHub Desktop.
window.onbeforeunload = function (e) {
var message = "Your change has not been submitted, if you exit the page without submitting your change will not be received.",
e = e || window.event;
// For IE and Firefox
if (e) {
e.returnValue = message;
}
// For Safari
return message;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment