I have an AJAX-based grid control.
We hook into the window.onbeforeunload event to check if they have unsaved data and if so present them with a message \"Are you s
I did something like this:
inside body tag:
var allowConfirm = true;
window.onbeforeunload = confirmExit;
function confirmExit()
{
if(allowConfirm)
return "Are you sure you want to navigate away from this page?";
else
allowConfirm = true;
}
When I Logout, I call this script:
allowConfirm = false; return window.location.href;