Re: help avoid multiple login
| From: | Jochem Maas | Date: | Tue, 29 Nov 2005 13:50:26 +0000 |
| Subject: | Re: help avoid multiple login | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-226582@lists.php.net to get a copy of this message | ||
Richard Heyes wrote:
Jochem Maas wrote:but there in lies a problem ... the onunload event fires everytime a page is unloaded (i.e. everytime you request a new page) as well as when you close the window. which effectively makes it useless for trapping when someone closes the browser. on top of that the user may have a 100 windows open for the same site ... if they close one then the session should remain active/valid - so in effect one would have to trap each window close and check if its the last window that was closed ... this is the road to madness ... not to mention the Opera browser functionality of being able to close the browser and open it again _exactly_ where you left off (no doubt a feature other browsers will start to emulate) which more than likely has some reliance on session cookies. pity there isn't an onsiteleave event :-)it might be possible to use some browser plugin to hit the server if it notices that it's window is being closed... although I have a sneaking suspicion that Flash, for instance, has the same problem as javascript with not being able to differentiate between the page unloading and the window closing. **as far as I know there is NO WAY to tell when the user closes the window, unless you give them a specific way of telling you (e.g. via a 'log off and close the window' link) and they are nice enough to only use the mechanism you provide (fat chance :-).You could use the onunload event to make an AJAX style call...
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/events/onunload.asp