To keep things very simple - I have the following code
$(window).bind("beforeunload",function(event) {
return '';
})
At least on Chrome,FireFox and IE9 - when a user closes the browser - he is presented with two options - "Stay on Page" or "Leave this Page" (The message varies from browser to browser)
Now how can I find out what option the user selected? For sake of simplicity - lets say - I want to show an extra message based on which option the user selected.
Something like - just to give an idea:
if(option=="Stay on Page")
alert("Thanks for continuing to stay");
if(option=="Leave this page")
alert("Sorry you decided to go - please come back soon");
How do I capture - what the user selected.