Richard Heyes wrote:
Jochem Maas wrote:

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...

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 :-)


http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/events/onunload.asp


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to