tamilsoft
May 9th 2008, 4:30 am
Hi,
I want to alert a message when the user trying to close the browser's window [like in gmail]. Can anyone help me?
GreatMetro
May 9th 2008, 8:44 am
<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()">
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.