Hi, I want to alert a message when the user trying to close the browser's window [like in gmail]. Can anyone help me?
<head> <title>Detecting browser close in IE</title> <script type="text/javascript"> var myclose = false; function ConfirmClose() { if (event.clientY < 0) { event.returnValue = 'Any message you want'; setTimeout('myclose=false',100); myclose=true; } } function HandleOnClose() { if (myclose==true) alert("Window is closed"); } </script> </head> <body onbeforeunload="ConfirmClose()" onunload="HandleOnClose()">