Skip to content

Instantly share code, notes, and snippets.

@ainsofs
Created April 28, 2015 08:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ainsofs/f845eec0cc3829b73353 to your computer and use it in GitHub Desktop.
Save ainsofs/f845eec0cc3829b73353 to your computer and use it in GitHub Desktop.
Jquery to prompt user to confirm that they want to leave the page
$(window).bind('beforeunload', function() {
var prompt = true; //if you dont return anything, the page will continue as normal
if (prompt)
return 'You have unsaved changes';
});
@ainsofs
Copy link
Author

ainsofs commented May 6, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment