At the time I last looked into this, the only reliable way was to have an
applet on the client; JavaScript didn't reliably know when the browser was
closed (it could know when somebody moved off the page, but not when the
window or app itself was closed), whereas applets were guaranteed to have
their stop() methods invoked when the page was closed for any reason.
JavaScript may have changed this in a later release (I last looked into this
about two years ago), but I still wouldn't rely on it too much.
Ted Neward
Patterns/C++/Java/CORBA/EJB/COM-DCOM spoken here
http://www.javageeks.com/~tneward
"I don't even speak for myself; my wife won't let me." --Me
-----Original Message-----
From: Vihung Marathe <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Tuesday, August 31, 1999 1:43 PM
Subject: Re: how to know if the browser is closed ?
>Since HTTP is a connection-less protocol, there is no way the server will
be
>informed that the browser is no longer running. As far as the server is
>concerned, the browser IS NOT running until the next request comes!
>
>The only way you can do what you want to do is by implementing something on
the
>client
>
>You could either have a JavaScript onUnload event handler , or have an
>[invisible] applet that only implements the destroy() method, to notify the
>server.
>
>Emmanuel JEGOU wrote:
>
>> Hi,
>>
>> I use sessions in my servlet and I would like to if it is possible to
>> know when the user close the browser window in order to initialize
>> something in my servlet.
>> So when the user will launch its browser later, the session will be new
>> !
>>
>> thanks.
>>
>> Emmanuel.
>
>-- V
>
>___________________________________________________________________________
>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