Click here to Skip to main content
15,868,016 members

Comments by mgkr (Top 4 by date)

mgkr 14-Mar-11 22:38pm View    
Deleted
Let me try with an analogy:

Say you are asked to detect when your car crashes hard into a wall (browser closing), so that you can, say, send out an automatic call for an ambulances (or an undertaker :-) ).

Your solution does not detect a crash, but simply that the engine died - Which happens to happen if you crash your car hard enough.

The problem is, it could also be that you just got home and simply turned of the engine yourself - Or you ran out of fuel, or the electrics of the engine died etc etc

You really wouldn't like to have the medics come running each time would you?

----
/*And no - The problem is not reliable solvable.*/
Please post an Alternate here if possible, I'm eagerly waiting for that(Also for opera too).
----

It [b]can not[/b] be (reliably) solved! So there is no (correct) alternative to post.

Hell, even the car manufacturers can't get it right - Airbags are pretty good, but they still go of all the time when they shouldn't :-)

At best your solution is an airbag - But it's not a truly 100% reliable solution. As that does not exist.
mgkr 14-Mar-11 21:58pm View    
Deleted
Yes I did notice the title.
I was trying to convey that onbeforeunload *does not* detect that the browser is closed.

It detects that the page is unloading - Which "by coincidence" happens to happen when you close the browser as well.

So no - Your solution does not detect what you claim and what the title is asking for. Hence the 1 vote.

This is an age old problem, hence my link.
If you read it you'll also see that if you use your approach you have to add code for catching all those cases that *are not* the browser closing, but triggers the event anyhow - I pointed out refresh as an obvious one even.

And no - The problem is not reliable solvable.
mgkr 14-Mar-11 16:22pm View    
Deleted
No no no :-)
It works on *anything* that "closes" the page - Including refresh and all sorts of other things.

Have a look here : very long link[^]
mgkr 14-Mar-11 16:19pm View    
Deleted
Reason for my vote of 1
Works on other than just closing the browser