Destroy Session on Browser Window Closing
View Single Post
05-08-2008, 06:05 PM
Join Date: May 2008
A simple rule to follow when dealing with cookies. When a user logs in or logs out, always run session_regenerate_id();
Village, and you are correct. The local session information is simply destroyed after x amount of time of inactivity. The AJAX call can happen, but is way more work then what its worth. The only viable way i could see anything coming close to working with what you described would be to
1) Frame the page, keeping one frame hidden.
2) When the hidden frame experiences the onunload event, pop open a new window of which will run the script to destroy the session.
Just an FYI for if you try it, you cannot make an AJAX call onunload. (IE specific I believe, works in firefox... may have that backwards though). I designed an ajax based chatroom before, and one of the ways of detecting if hte user had logged out was checking firing off an AJAX call onunload. One of the browsers wouldn't let it happen though.
View Public Profile
Send a private message to drewbee
Find More Posts by drewbee