function preventBackWindow() {
    var userAgent = navigator.userAgent;
    var isFirefoxAgent = false;

    if (/Firefox[\/\s]/.test(userAgent)){
        isFirefoxAgent = true;
    }

    if(!isFirefoxAgent) {
        preventIE();
    } else {
        preventFF();
    }
}

function preventIE() {
    window.history.forward();
    window.onunload = function() { void(0) }
}

function preventFF() {
    window.onunload = function() { void(0) }
    
    var j = 1;

    if(window.location.href.endsWith('#')) {
        j = 0;
    }

    while(j < window.history.length) {
        j = j+1;
        window.history.forward();
    }
}
