aspose file tools*
The moose likes Servlets and the fly likes if browser is closed,does session expire? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "if browser is closed,does session expire?" Watch "if browser is closed,does session expire?" New topic
Author

if browser is closed,does session expire?

alex han
Ranch Hand

Joined: Dec 13, 2002
Posts: 46
1 in a web application,if a user closed his browser(platform is windows),does his session that in server is expired?
2 if he not close the browser ,but navigator to
another page that no relationss with this web application . does his session that in server is expired?

3 if above two not come into existence,is there
any method that let session expire when user closed browser or navigator to another page??

thanks a lot
Amol Desai
Ranch Hand

Joined: Jan 29, 2003
Posts: 82
Hi,
1. If the user closes the browser , his session in that server is expired.
2. No his session in the server is not expired
if he navigates to another page that has
no relationss with this web application
3. With respect to answer 2, you cannot expire the session by opening a new browser window without closing the existing window,since the server does not know this since it is the client side activity.
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
han,
Please change your name to be compliant with JavaRanch's naming policy. It should not be obviously fictitious.
Your displayed name should be 2 separate names with more than 1 letter each. We really would prefer that you use your REAL name.
You can change your name: here.
Thanks,
Cindy


"JavaRanch, where the deer and the Certified play" - David O'Meara
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12805
    
    5
1. Not exactly - his cookie that relates to the session is lost by the browser but the actual session object stored on the server is not invalidated until the servlet engine timeout is hit.
The subject of how to detect that a user has "left the site" has been discussed numerous times here - dig around in the archives.
Bill
 
 
subject: if browser is closed,does session expire?