confirm page exit
Posted: Mon Feb 11, 2008 12:35 am
I'm trying to display a confirm if a user tries to exit a page... This is the code I have (using jquery)... The problem is the return false, does nothing... it still exists or refreshes, or whatever.. Anyone know how I can prevent the page from closing, redirecting, refreshing, etc if a user clicks "Cancel", thanks!
Code: Select all
$(window).unload(function(){
exit = confirm("Your settings are not saved, are you sure you want to leave this page?");
if(exit == false){
return false;
}
}
);