I have logical application running where i need to store the var algorithmToApply=1 or etc
;
Where each of my value has relative algorithm assigned. The main problem is while testing people clicking on browser refresh button and all my application logic crash.
algorithmToApply = 1 ; // Thinking
algorithmToApply = 2 ; // Waiting
algorithmToApply = 11 ; // Downloading
algorithmToApply = 100 ; // Booting
algorithmToApply = 900 ; // Kernel prepare
algorithmToApply = 0 ; // User refresh button is a BUG
How can i using JavaScript request Browsers (Opera or Chrome optionally Firefox/Safari), to allow me to restrict user not able to click refresh (however they can always shutdown or close my browser instance).
Is this possible? If so how?
Follow up: (best we can do )
/* @WARNING: Do not refresh */
$(window).bind('beforeunload', function(e) {
if (mystatus>=2) {
return "WARNING: Your status is .... If you refresh now, software will lose all the status.";
} else {
return "WARNING: Your status is not ... You can refresh.";
}
});