File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes How to do logout when browser closes in jsf Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "How to do logout when browser closes in jsf" Watch "How to do logout when browser closes in jsf" New topic
Author

How to do logout when browser closes in jsf

siva prasa
Greenhorn

Joined: Feb 16, 2010
Posts: 25
How to do logout and session invalidate when the user closes the browser in between the application using JSF???Any ideas welcome....
Hany Shafik
Ranch Hand

Joined: Jun 21, 2008
Posts: 80
While it may be possible to register an event listener to be called back when the browser closes using JavaScript (Howerver most of the time it doesn't wok perfectly), You can't rely on such mechanism as the browser may shutdown due to crash or even worse the network connection may get disconnected for any reason before issuing the request to invalidate your session.
That is why you must rely on having a session timeout as your reliable mechanism to invalidate your session.
However there are cases that it is essential for you to know whether the client is still active or have navigated away (e.g. Webbased chat application). In such cases due to the statelessness of the HTTP protocol, you can make the browser continuesly poll the server to let the server know that he or she is still alive, but this may consume your network resources.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to do logout when browser closes in jsf
 
Similar Threads
perform a specific task on logout/closing of browser
logout on browser close
logOut script not working
Session handling
Session