I have this inside my $(document).ready
function:
$(window).unload(function() {
check_saved();
});
check_saved()
just triggers a dialog box that asks the user if they would like to save their form data before leaving the page. The browser displays the dialog box but then navigates away instantly. I want the browser to wait until the users clicks a button, just like it would for a normal alert()
. How do I do this? Also, chrome seems to ignore the unload event? Any ideas?