Well IT IS actually possible for the browser to inform the server that it
has been closed.! You would have to do the scripting via JavaScript though.
You could set a onunload() event handler for the window. This onunload event
handler could then call a server-side script with the parameter close=true.
The server-side script could then use this information to perform some-clean
up operations. However the sever-side script SHOULD NOT write to the client,
because by that time IE/NS would have closed the window down.
A rough outline of how this works is like follows :
<script language="javascript">
window.onunload = function() {
location.href="detect_close.jsp?close=true";
}
</script>
You could do whatever you want in the JSP. Note that the JSP WILL KNOW which
client has shut the window, because the browser would send the
session/cookie data in the request just before the window shuts down.
----- Original Message -----
From: "Kevin Mukhar" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, April 27, 2001 7:56 PM
Subject: Re: How to detect browser stop
> Sudarson_Pratihar wrote:
> >
> > Is there any way to detect browser stop?
>
> No. It's been a while since we had this discussion here, but the answer
> is still the same: the browser does not notify any server when the
> browser is stopped or exited. You might want to check the archives to
> review past discussions on this topic.
>
> > So that if a user clicks the
> > browser stop, the servlet at the server side can be destroyed.
>
> You don't want to do this anyway. The servlet is a server resource and
> should generally be available as long as the server is running. The best
> way to deal with this situation is just to catch the IOException that is
> thrown when the servlet tries to send the response to the client; since
> the client no longer wants the response, there's really nothing else to
> be done.
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html