You are here: Re: when browser is closed « All PHP « IT news, forums, messages
Re: when browser is closed

Posted by Dundonald on 10/12/06 11:18

Gordon Burditt wrote:

> >I have a site accessible via a login system. I would like to track login and
> >logout time for every user. I can get the login time no problem - as every
> >time someone logs in, a row is added to a mysql table. The problem happens
> >with logout as almost no one uses the logout button; rather they just close
> >the browser window.
> >My question is therefore - am i able to capture the time the browser is
> >closed?
>
> No.

Not strictly true. The onunload event can be captured within a page and
by use of a HTTP redirect used to call appropriate code to clean up
session data etc ... Be warned though as always various browsers don't
support onunload, but my experience with IE has so far been OK since
version 4.

>
> >all login data is stored in a session; so is there a way to find out
> >the time the session got deleted which would mean user has left ?
>
> The session being deleted does NOT mean the user has left. And the
> user may leave WITHOUT closing the browser window (he may type in
> a URL, click on a bookmark, etc.) Unless the user is highly motivated
> to explicitly log out (like the site contains private info or can
> be used to spend real money), the vast majority of logouts are going
> to be by timeout.

The onunload also triggers when a user moves off of your page by typing
a different URL.

>
> You also don't get to run code when the session data is about to
> be deleted.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация