FruitNotes beta
Your All-in-One Online Notebook
FruitNotes Blogs | Home  
detecting window close event
Last updated at (Fri Dec 28 2007 04:07:22)
Posted by: Nitin Gupta
0%




http://endoflifecycle.blogspot.com/2007/06/detect-window-close-event.html
<script type="text/javascript">

// event below works both in IE6,7 and Firefox
window.onunload = function()
{
// do processing here
alert('bye!');
}

function showUnloading(evt){
//IE specific code to cancel the navigation
//if you put a text value in that property IE will try to confirm
//if you want to navigate off the page.
//The code also works with Firefox
evt.returnValue = "You are leaving.";

//Firefox GeckoDOM specific
//below is how to handle the cancelling of firefox
if (!confirm('Are you sure?'))
{
evt.preventDefault;
evt.stopPropagation; // this makes sure it does not bubble up
}

}
</script>

<body onbeforeunload="showUnloading(event); >
</body>


Rate this blog

   Report Abuse


Comments


From krunal developer at Thu Mar 12 2009 16:04:15 GMT 0530 (India Standard Time)

it doesnt work bro....

-----------

Leave your comment(s) below:
To start Your own Blog




Other Blogs
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
» 
2007 FruitNotes.com - All Rights Reserved.