How do I stop my webpage cleanly in Firefox?

Viewed 252

I have created an IIS MVC webpage.

Users find that if they leave it open overnight it is in some "frozen" state in the morning and it has also frozen any other tabs that might be open in the brower.

Therefore, they have to kill the whole browser window and log into my webpage again.

How can I cleanly shutdown(or put into nice state) my webpage at 10PM?

I have tried the following, which works on Chrome, but not Firefox:

setTimeout(function () { quitBox('quit') }, millisTill10);

function quitBox(cmd) {
    if (cmd == 'quit') {
        open(location, '_self').close();
        window.close();
    }
    return false;
}

I am happy to leave the tab there - but put it into some kind of clean, dead state, that would not interfere with the other tabs.

I have tried to catch the error to fix it - but I have no idea what is causing it to freeze. The code below does NOT catch it:

window.onerror = function(error, url, line) {
alert('Inform please ERR:'+error+' URL:'+url+' L:'+line);
};

Fuller version:

    window.onerror = function (errorMsg, url, lineNumber, column, errorObj) {
        var stackTrace = "Not available";
        try {
            stackTrace = errorObj.prototype.stack
        } catch (e) {
            try {
                stackTrace = errorObj.stack
            } catch (e) {
                try {
                    stackTrace = errorObj.error.stack
                } catch (e) {
                }
            }
        }

        alert('Please inform of Error: ' + errorMsg + ' Script: ' + url + ' Line: ' + lineNumber
        + ' Column: ' + column + ' StackTrace: ' + errorObj + ' ST: ' + stackTrace);
    }
3 Answers
Related