| Author |
Clearing httpsession on window close, techniques?
|
Alok Pota
Ranch Hand
Joined: Mar 07, 2001
Posts: 185
|
|
Anybody have a bag of tricks to have the session invalidated when closing the browser window. One of the tricks that I know: Have a hidden iframe and have it navigate to the url that invalidates the session when window closes.
|
 |
Sanjeev Kaushik
Ranch Hand
Joined: Aug 01, 2002
Posts: 105
|
|
you can use the "onUnload" event of the body tag. Onunload you can try call the server side, which can invalidate the session object. Hope this helps. Sanjeev
|
Sanjeev Kaushik
|
 |
Alok Pota
Ranch Hand
Joined: Mar 07, 2001
Posts: 185
|
|
Yeah, but onUnload also gets called when I get out of the page through valid exit points (say Clicking the Cancel button). There needs to be an onClose event for the DHTML window object.
|
 |
Mary Cole
Ranch Hand
Joined: Dec 02, 2000
Posts: 362
|
|
Hey, Can U elaborate on the first technique which U suggested... Paste the code if necessary
|
 |
Mary Cole
Ranch Hand
Joined: Dec 02, 2000
Posts: 362
|
|
|
Could anybody pls answer my previous posting pls
|
 |
Jeroen Wenting
Ranch Hand
Joined: Oct 12, 2000
Posts: 5093
|
|
The ONLY way to notify the server that the browser is no longer there or is moved to another site is to put some Javascript in the onunload event for the body tag of the page. Here you can have the browser then call a servlet on the server which can invalidate the session. As said, there is a potential problem in that it also gets called when you move to another page on your site, but I think there are ways to circumvent that. I've never used the function myself.
|
42
|
 |
 |
|
|
subject: Clearing httpsession on window close, techniques?
|
|
|