closed. Here are some very limited things you can do to tell if the client
is still on your page (whether open or closed)
While your server is processing a request, if it takes a long time to
service that request, you can call Response.IsClientConnected to see if
the
browser is still on your page.
You can add code to your page's client onunload event which could notify
your server that the page is unloading. This will not tell you if the
browser is being closed.
For example: <body onunload="alert('closing');">
If you use this method, use showModalDialog to browse to a page which
notifies your server. That page will return JavaScript back to the dialog
with window.close();.
Another option is that you could write an ActiveX control. However, that
control will only exist so long as the user is on your page. You still
won't know if they close the browser.
Essentially, the internet was designed such that the server only knows
about the browser while it is processing a request from the browser. The
rest of the time, the server is not aware of the browser.
Does this answer your question?
Thank you, Mike
Microsoft, ASP.NET Support Professional
Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three
straightforward
steps listed to improve your computer's security.
This posting is provided "AS IS", with no warranties, and confers no
rights.
--------------------
From: "hb" <
[email protected]>
Subject: Help: How to detect if the browser is closed?
Date: Mon, 17 Nov 2003 09:09:01 -0500
Lines: 11
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <
[email protected]>
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: x403446fe.ip.e-nt.net 64.52.70.254
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.aspnet:191366
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
Hi,
Would you please tell me how to detect if the client's browser is
closed?
I need such event to trigger a database modification.
Thank you
hb