Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to I kill a session when a browser window is closed using X

Status
Not open for further replies.

IQ

Programmer
Mar 15, 2000
20
0
0
GB
I have an ASP application, that when called creates another browser window with no buttons etc. to help me control navigation within the application.<br><br>I also have a logout button which when pressed abandons the session.<br><br>However, when a user clicks the X in the top right hand corner of the browser&nbsp;&nbsp;the window closes and focus is passed back to the original window.<br><br>This window still holds the session object open. If this window is closed then the session closes but not before. <br><br>Is there any way of trapping when the browser window is closed so I can abandon the session.<br><br>Thanks<br><br>IQ
 
You can create a function in your original window that checks for the existence of the navigation window, and automatically logs out if it's not there, and call it every few seconds using setTimeout.<br><br>In my experience, I've found you can't reliably catch all instances of the user closing a browser window. <p>nick bulka<br><a href=mailto:nick@bulka.com>nick@bulka.com</a><br><a href= > </a><br>
 
I have had a similar problem and the easiest (probably not the most efficient) way to solve the problem is to have another seperate window that's sole purpose is to end the session (because there is no Client&gt;&gt;Server mechanism in ASP, only Server&gt;&gt;Client). use onunload event handler in the nav window to open a new window (like popups when you close, 10 more open up) and the new window's source has Session.Abandon in it, Then just use a setTimeout to close the window.<br><br>Jeremy Lowery
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top