Hey, first of all appreciate your efforts on getting browser close click. As far as I know, there is no way to call a Servlet Method by detecting browser close event. I can access to atrributes for the session after invalidating it. My question is from URL Rewriting. Forexample; in many Banking applications you should see a button to close the Session in a secure way. store session in asp in javascript function. Today I faced a problem in my java application .User session didn't destroy wn I directly closed browser without logout user. Actually I have 3 scenarios to close session: 1.- A user close session using a button. :-) Posted 13-Oct-11 22 ... How to clear sessions on browser close. How can we improve the log out or closing the browser to invalidate the session? I am debuging in the "back" request in my servlet. Question is, Suppose a session object is created at server side and we use URL Rewriting for maintaining session. If you truly call session.invalidate(), then the session is gone. then again I open the browser goto the history and click on the link in which Jsesionid is attached. In a web application you might want to invalidate user session, for instance in a logout Servlet or JSP. Can anybody help me for same. When the browser is closed, the session id that is sent from the server to the browser is lost. After that I close my browser but session object at the server side is still there(not timed out). Do you really need to invalidate the session? If you're talking about *across* browsers, there will be a new session created when the user logs in … Pressing the back button in your browser is simply pulling the page from your local cache, not A Session in HTTP is simply a bookmark that the server sends to the client so that on the next request the same application context will be used. Its working fine but It would be better if you could find the back button click and refresh button click of the browser in java … how can i run tomcat server and my home page come when i double click on an icon in servlets how can i run tomcat server and my home page come when i double click on an icon in servlets Hi.. there if we are giving a small application to end user he does not know to run server by service runner... and he does not know For example, imagine the session is an encrypted value that includes a secret, and when the server receives the session, de-crypts it, and accepts the session only if the value matches a secret? The user should click this button to close the session or the session times-out by server. If so, you have a couple of options. Hello everyone , I have a problem related to session handling in my code how to write a session invalidate method in browser tab closed or browser "X" closed event in servlet and how to handling session timeout when session is timeout how session expire page is display in jsp when session … Maybe you should read Silvio's reply a little more closely. Any new attempt to access the server for that session from a new browser will automagically fail because it no longer contain the session id. 2.- A user close the browser, so you call beforeClose using javascript 3.- The session … After some time (less than default time which is … But if a user logs out of the app from one browser it depends on the browser whether or not the session will be maintained: some browsers create new sessions for new windows, or new tabs. coderanch.com. How to invalidate the session on browser close. Thanks in advance. It isn't possible. Setting session variable in javascript function. No problem you can do what you need. I am developing one application in which i want to clear session and redirect user to another page by using java script function.