FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Capture logoff on browser close
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Capture logoff on browser close [message #169742 is a reply to message #169739] Fri, 24 September 2010 12:58 Go to previous messageGo to previous message
alvaro.NOSPAMTHANX is currently offline  alvaro.NOSPAMTHANX
Messages: 277
Registered: September 2010
Karma:
Senior Member
El 24/09/2010 14:50, Bill Braun escribió/wrote:
> I would like to update a mysql record with a logoff time if the user
> fails to affirmatively logoff and only closes the browser. My research
> indicates this is fluky, unreliable, difficult, impossible, or all of
> the above. Any practices you know of that may improve the chances of
> capturing such a log off time?

You've done very good research so there's not much I can add to that.

If it is such a mission critical piece of info (or there's a manager
that's willing to make you waste time on it) you could try a difference
approach. Perhaps you can implement a "ping" feature with JavaScript.
Write some client-side code that runs at specific internals (perhaps
once a minute) an performs an HTTP request to the server. Store these
pings in the database. As soon as they stop coming in, you can assume
the user closed the browser (or had a network outage or hibernated his
computer or your script stopped working). On this line, you can capture
the onbeforeunload event (not sure about the exact name) and send a
"bye-bye" ping to the server (if you're very lucky, it may even get on
time to the server).

This method is fluky, unreliable, difficult, impossible or all of the
above so it may suit your problem :)


--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Authentication code creation for google analytics API in PHP
Next Topic: APC + Multi-Site Install of Single Application
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 09:59:07 GMT 2024

Total time taken to generate the page: 0.04340 seconds