Re: [PHP] how to kill a session by closing window or tab clicking on X?
- From: ash@xxxxxxxxxxxxxxxxxxxx (Ashley Sheridan)
- Date: Mon, 27 Oct 2008 21:04:47 +0000
On Mon, 2008-10-27 at 09:56 -0500, Afan Pasalic wrote:
Stut wrote:You could set the timeout to a low value, and have the browser make AJAX
On 27 Oct 2008, at 14:10, Afan Pasalic wrote:
I'm sorry for posting this more javascript then php question, but
it's somehow php related.
here is the issue: very often people close the window/tab without
logging out. I need solution how to "recognize" when [x] is clicked
(or File >> Close) and kill the session before the window/tab is closed.
few years ago, before firefox and tabs, I solved this by javascript
and onClose() as a part of body tag. now, it doesn't work anymore.
any suggestion/opinion/experience?
That event should still fire regardless of whether it's a window, tab
or iframe. It refers to the page closing, not the window. However, any
event that fires when the user leaves a page (either by clicking on a
link or closing the window) is likely to be prevented by popup
blockers, so you can't rely on it working at all.
A sensible session timeout is the only real solution to this "issue",
possibly aided by a periodic keepalive request.
-Stut
as you said, I was asked by pop-up blocker to allow this "event". I can
use it - in case there is no popup blocker but in general, as you said,
can't rely on this.
session timeout will do the jobe. not exactly the way I want but...
thanks.
afan
requests at an interval less than this. If you don't get your session
update request from the browser, you can deem it as crashed or closed.
Ash
www.ashleysheridan.co.uk
.
- References:
- how to kill a session by closing window or tab clicking on X?
- From: Afan Pasalic
- Re: [PHP] how to kill a session by closing window or tab clicking on X?
- From: Stut
- Re: [PHP] how to kill a session by closing window or tab clicking on X?
- From: Afan Pasalic
- how to kill a session by closing window or tab clicking on X?
- Prev by Date: Re: [PHP] question about using sql server with php
- Next by Date: Re: [PHP] question about using sql server with php
- Previous by thread: Re: [PHP] how to kill a session by closing window or tab clicking on X?
- Next by thread: preg_match
- Index(es):
Relevant Pages
|