From: Laser Lips on
Hello all. I've looked on Google and it appears there is no
definitive way of checking when someone closes a browser.
I need to perform a load of things when the browser closes and need to
check when the browser shuts down.
How do you deal with it?

Graham
From: David Mark on
Laser Lips wrote:
> Hello all. I've looked on Google and it appears there is no
> definitive way of checking when someone closes a browser.
> I need to perform a load of things when the browser closes and need to
> check when the browser shuts down.
> How do you deal with it?
>

You don't. Sorry.
From: Stevo on
Laser Lips wrote:
> Hello all. I've looked on Google and it appears there is no
> definitive way of checking when someone closes a browser.
> I need to perform a load of things when the browser closes and need to
> check when the browser shuts down.
> How do you deal with it?
>
> Graham

There are the onunload and onbeforeunload events, but they're not unique
to a "closing" browser. They fire just the same if somebody navigates
elsewhere. You can't be guaranteed to get them though (e.g. if someone
hard-closes the browser from the task manager). Also, you're limited in
some browsers to what you can do in a handler from these events. For
example, in Safari you can't make any http requests (they'll be blocked).

It might be better if you explain the things you need to do as there may
be better alternatives.
From: Laser Lips on
I'm working with a technology called CACHE which is made by
Intersystem’s.

I need to do a couple of things when the browser closes.

I need to log the user out of the system.
I need any locks in the CACHE database to be unlocked.
CACHE will not know when the browser closes because like any server
side technology, it does not have a permanent connection to the
browser.

I can't have Ajax polling the server because there will be to many
server calls.
I really need these locks to be taken off immediately.
If the user exists using the log out buttons then these locks are
removed, it's just when they hit the [X] that I can't catch.

Graham


From: Stevo on
Laser Lips wrote:
> I'm working with a technology called CACHE which is made by
> Intersystem�s.
>
> I need to do a couple of things when the browser closes.
>
> I need to log the user out of the system.
> I need any locks in the CACHE database to be unlocked.
> CACHE will not know when the browser closes because like any server
> side technology, it does not have a permanent connection to the
> browser.
>
> I can't have Ajax polling the server because there will be to many
> server calls.
> I really need these locks to be taken off immediately.
> If the user exists using the log out buttons then these locks are
> removed, it's just when they hit the [X] that I can't catch.
>
> Graham

Some sites use auto-logout timeouts both client side and (with a
slightly longer timeout) server side. No good for you?

Hooking into the onunload or onbeforeunload and logging out from there
would certainly help (although not with Safari as I mentioned).