I am displaying a warning dialog box on window close event. If user clicks on Cancel control stays on same page or if user clicks on Okay he get navigated to desired page.
I want collect the value of dialog box means whether user have clicked on Cancel or Okay.I have written following code in external JavaScript:
$(document).ready(function()
{
window.onbeforeunload = askConfirm;
function askConfirm()
{
if (flag)
{
// Message to be displayed in Warning.
return "Your unsaved data will be lost.";
}
}
}
How can I collect the value?
example code
http://files.dropbox.com/u/642364/blogger/scripts/close.html
EDIT
Getting the response code from the user on window close