http://jsfiddle.net/Guruprasad_Rao/cezjbuky/
I have got the window.onbeforeunload
event to prevent from closes like click on cross button on the browser or click on Ctrl + W.
How can I capture what the user has clicked on (whether user chose Leave This Page
Or Stay on this Page
)?
function warning(){
if(true){
return "You are leaving the page";
}
}
window.onbeforeunload = warning;
function togooglepage()
{
window.location = "www.google.co.in";
}
function toyahoopage()
{
window.location = "www.yahoo.com";
}