Re: disconnect
- From: Andy Hassall <andy@xxxxxxxxxxx>
- Date: Fri, 29 Apr 2005 00:46:43 +0100
On Thu, 28 Apr 2005 22:41:57 GMT, Jeff North <jnorthau@xxxxxxxxxxxx> wrote:
>>| >(in another words when the clients closes its browser)
>>|
>>| Closing the browser has nothing to do with closing the connection to Apache.
>>|
>>| >I'm doing a php extension under win32/apache and I don't "see" any message
>>| >I can trap to detect that kind of state...
>>|
>>| There is no reliable way to do this; it's not how HTTP works.
>>|
>>| There are possibly Javascript methods to do this, try comp.lang.javascript for
>>| more details.
>
>Not even javascripting can help :-(
>If the user clicks on a button on your page then you can capture this
>event. If the user types in an address in the Address bar, used
>favourites or closes the browser window completely then there is no
>way of capturing this event.
Well, a couple of methods that spring to mind:
(1) Unreliable, non-standard method:
Use the non-standard "onUnload" event to fire off a Javascript function when
the user closes browser or navigates away from a page. This could fetch a page,
e.g. with an XMLHTTPRequest.
onUnload does not exist in the HTML standards, which makes this very bad, nor
is it reliable, since it's Javascript in the first place.
See: http://www.quirksmode.org/js/events/window.html
(2) Utterly unspeakably nasty method:
Use Javascript timers to repeatedly and rapidly request a page using some
unique ID, possibly the PHP session ID. If the user navigates away, the
server-crippling stream of requests ceases, and some sort of daemon process on
the server side could detect that no requests had arrived in the last few
seconds.
I think I have to now wash my keyboard after suggesting such a thing. Ugh.
--
Andy Hassall / <andy@xxxxxxxxxxx> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
.
- Follow-Ups:
- Re: disconnect
- From: Andy Hassall
- Re: disconnect
- References:
- disconnect
- From: ste
- Re: disconnect
- From: Andy Hassall
- Re: disconnect
- From: Jeff North
- disconnect
- Prev by Date: Re: disconnect
- Next by Date: Re: disconnect
- Previous by thread: Re: disconnect
- Next by thread: Re: disconnect
- Index(es):