How to end a session immediately when the browser closes?

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Jun 2005
Posts: 50
Reputation: Naters_uk is an unknown quantity at this point 
Solved Threads: 0
Naters_uk Naters_uk is offline Offline
Junior Poster in Training

How to end a session immediately when the browser closes?

 
0
  #1
Feb 8th, 2006
Sessions DO NOT end when a user closes their browser. There is no communication with the server when a browser is closed so there is no way the server can know to end the session. The same is true when you leave the site for another. Again no communication takes place between your browser and the site you're leaving so the server never knows you've left.

Basically the only solution I know of is to set up a client-side event to call a server-side script to abandon the session when the user leaves.

Anyone knows how to write a javascript to end a session when the browser is being closed?
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 1,655
Reputation: tgreer is an unknown quantity at this point 
Solved Threads: 35
Team Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: How to end a session immediately when the browser closes?

 
0
  #2
Feb 8th, 2006
Sessions are controlled by the web server... you can't terminate them with JavaScript code. Usually, sessions are set to time-out in 15 minutes (I think that's IIS' default, different web servers may vary).
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum


Views: 4993 | Replies: 1
Thread Tools Search this Thread



Tag cloud for JavaScript / DHTML / AJAX
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC