You could place a Javascript function reference that calls a servlet in
every page's "onunload" event handler.

The trick would be to be sure to keep track of the number of open browser
windows the user has.....
if there is only 1 and the "onunload" is triggered, then the session with
that site has effectively ended.


> -----Original Message-----
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Shane Duan
> Sent: Monday, July 10, 2000 12:19 PM
> To: [EMAIL PROTECTED]
> Subject: Re: how to detect a browser closing
>
>
> Since a server is a program that takes request and send response, and
> that the Internet connection is stateless, I don't think you can use the
> server to detect when the browser is closed.
>
> The only way I know would be to set a time out on the session and do the
> logic when the session time out occurs.
>
> Hope that helps.
>
> Shane Duan
> [EMAIL PROTECTED]
>
>  -----Original Message-----
> From:   Ionel Condor [mailto:[EMAIL PROTECTED]]
> Sent:   Monday, July 10, 2000 7:22 AM
> To:     [EMAIL PROTECTED]
> Subject:        how to detect a browser closing
>
> Hi,
> I have the following problem:
> I want to detect on the server side when a user (which has an open
> session on the server) has closed his browser by pressing the "X" close
> button of the window.
> I know that using http sessions is probably the unique way, but I don't
> know how, as I
> don't know if the server can't initiate by itself such a check ?
>
> Many thanks for any suggestions,
> Ionel C.
>
> ========================================================================
> ===
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
> ==================================================================
> =========
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to