On Jun 11, 7:53 pm, "Mark Rae [MVP]" <m...@markNOSPAMrae.net> wrote:
> "subtile" <subt...@discussions.microsoft.com> wrote in message
>
> news:2D27ACB3-6D94-4A92-A5D6-...
>
> [top-posting corrected]
>
> > would it be possible with som javascript.. calling a webservice ?
>
> Not reliably... The JavaScript would fire every time the page closes i.e.
> while moving from page to page within the same web app, and also during
> postback etc...
>
> --
> Mark Rae
> ASP.NET MVPhttp://www.markrae.net
Hi,
what Mark is said is absolutely true and i found a little workaround
to that...
here is the code i tried and found working on both IE and Firefox...
<body onbeforeunload="doUnload()" onmousedown="somefunction()">
<form id="form1" runat="server">
</form>
</body>
<script language="javascript" type="text/javascript">
var isClose = false;
function somefunction()
{
isClose = true;
}
function doUnload()
{
if(!isClose)
{
alert('window is closing');
}
}
</script>
this code is not perfect ... you guys can find some flaw ... still it
works... for most of the cases...
Best of luck
Munna
www.munna.shatkotha.com
www.munna.shatkotha.com/blog