15,610,517 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View Python questions
View Javascript questions
View C++ questions
View Java questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
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