423,113 Members | 1,957 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,113 IT Pros & Developers. It's quick & easy.

Browser Crash Handler

RamananKalirajan
100+
P: 607
Hi,
Is there any event listener or window listener for Browser Crash event other than onUnload? Is there any way to call a JS function when an application or system is crashed?

Regards
Ramanan Kalirajan
Apr 24 '09 #1
Share this Question
Share on Google+
13 Replies


Dormilich
Expert Mod 5K+
P: 8,639
when a system crashes it usually doesn't execute anything until reloaded… (in FF there may be a setting available where the crash status is given so you can execute something on reload)
Apr 24 '09 #2

acoder
Expert Mod 15k+
P: 16,027
I don't think so, though you could probably write browser-specific code to deal with a "crash" event. What kind of function would you want to run?
Apr 24 '09 #3

RamananKalirajan
100+
P: 607
In my application I am maintaining the user details in session. When the browser crashes the facilities must be released for that only. Previously i tried with onUnload in body it works in IE but not in Mozilla, due to Security issues they have prevented executing onunload. Then thought of using onbeforeunload listener but there are some drawbacks in using them such as, it allways prompts a confirmation msg, It is triggered even when the page is refreshed. Is there any suggestion regarding this..... Thanks in advance.

Regards
Ramanan Kalirajan
Apr 24 '09 #4

acoder
Expert Mod 15k+
P: 16,027
Is there any reason why you want to invalidate the session? You can set a timeout of 20 minutes or half an hour.
Apr 24 '09 #5

RamananKalirajan
100+
P: 607
Ya I have set that thing. But I want to know wether there is any possibility to handle this condition.

Regards
Ramanan Kalirajan
Apr 25 '09 #6

acoder
Expert Mod 15k+
P: 16,027
Not that I'm aware of, cross-browser, at least. If the browser does crash and the page is reloaded and the session continues, what's the harm?
Apr 25 '09 #7

RamananKalirajan
100+
P: 607
The harm is that, for each and every user will be provided with a Order ID & PON no. dynamically whenever he login to the application, those information will be stored in the DB. Without completing an order if the customer logout means we will be releasing that order id, pon and assign that to some other user. This should occur when the system crashes also. I used onBeforeUnload it was showing a prompt message even the page is refreshed and navigated to other page. In IE I used mouse click event to trace wether the user is clicking the browser close button with the PageX, PageY it was working in IE but not in mozilla due to the ClientWidth & ClientHeight are different in IE and Mozilla. I just wanted to find out wether there is any other JS function would work during the browser close event/Browser Crash. Thanks for all of ur suggestion.

Thanks & Regards
Ramanan Kalirajan
Apr 28 '09 #8

acoder
Expert Mod 15k+
P: 16,027
I understand, but if the user immediately restarts the browser and continues the session, it's the same as staying a minute or so on one page.
Apr 28 '09 #9

RamananKalirajan
100+
P: 607
Yes.. That cant be done....

Regards
Ramanan Kalirajan
Apr 29 '09 #10

Expert 100+
P: 392
@RamananKalirajan
This is something that needs to be done on the server side. The client side not reliable enough to carry out critical funcitons. There are too many knowns. Difffernt browser bugs, differnt browser plugins that can change behaviors, different browser security settings that can prevent JavaScript features etc. etc. This also would not handle the problem of OS level crashes, or loss of network connectivity. The server side logic needs to handle critical functions like this. Why are you assigning order numbers to people as soon as they login? That seems to be the core issue. Most systems do not assign an order number until the user places an order, and are able to avoid this problem.
Apr 29 '09 #11

RamananKalirajan
100+
P: 607
Thanks for your suggestion.


Regards
Ramanan Kalirajan
May 5 '09 #12

P: 1
Were you ever able to figure this out?
I have the same problem now but i am not able to find any useful solution.

Thanks
Jun 8 '18 #13

gits
Expert Mod 5K+
P: 5,172
well - it is impossible with javascript - javascript "runs on the webpage" - if the browser crashes the javascript-program crashes with it naturally. so the application has to be implemented in a way that such cases wouldn't hurt - thus it would avoid the need of a solution to solve an issue that a webpage/-application shouldnt even need to take care of.
Jun 11 '18 #14

Post your reply

Sign in to post your reply or Sign up for a free account.