1.前进后退抵消法

javascript:window.history.forward(1)

2.兼容所有禁止后退

    history.pushState(null, null, document.URL)
    window.addEventListener('popstate', function () {
        history.pushState(null, null, document.URL)
    });

3.禁止右键弹出菜单

document.oncontextmenu=function(){
    return false
}

4.禁用F5刷新

document.onkeydown=function(){
    if (event.keyCode == 116){
        event.keyCode = 0
        event.cancelBubble = true
        return false
    }
}

5.禁用F5与ctrl+r刷新

document.oncontextmenu = function () { return false; }//禁止右键
    document.onkeydown = function (e) {//键盘按键控制
        e = e || window.event;
        if ((e.ctrlKey&&e.keyCode==82) || //ctrl+R
            e.keyCode == 116) {//F5刷新,禁止
            //阻止默认刷新时间
            e.returnValue = false
            if (e.preventDefault) e.preventDefault();
            else e.keyCode = 0;
            //你的刷新IFrame代码
            return false;
        }
}
window.onbeforeunload = function (e) {
   return (e || window.event).returnValue = '确认要离开当页面?!';
}
document.write(new Date().toLocaleString())//测试用的,判断是否刷新了

6.其他屏蔽

document.onkeydown = function(e) {
        e = window.event || e
        var k = e.keyCode
        //屏蔽ctrl+R,F5键,ctrl+F5键  F3键
        if ((e.ctrlKey == true && k == 82) || (k == 116) || (e.ctrlKey == true && k == 116)||k==114) {
            e.keyCode = 0
            alert("当前页面不能刷新!")
            e.returnValue = false
            e.cancelBubble = true
            return false
        }
        if (k == 8) {
            alert("不能返回或后退!")
            e.keyCode = 0
            e.returnValue = false
            return false
        }
        //屏蔽 Ctrl+n
        if (e.ctrlKey && k == 78){
            e.keyCode = 0
            e.returnValue = false
            e.cancelBubble = true
            return false
            }
        //屏蔽F11
        if (k == 122) {
            e.keyCode = 0
            e.returnValue = false
            e.cancelBubble = true
            return false
        }
        //屏蔽 shift+F10      
        if ((e.shiftKey && k == 121)||(e.ctrlKey && k == 121)){
            e.keyCode = 0
            e.returnValue = false
            e.cancelBubble = true
            return false
            }
        //屏蔽Alt+F4  
        if ((e.altKey) && (k== 115)) {
            window.showModelessDialog("about:blank", "","dialogWidth:1px;dialogheight:1px")
            e.keyCode = 0
            e.returnValue = false
            e.cancelBubble = true
            return false
        }
        //屏蔽 Alt+ 方向键 ← ;屏蔽 Alt+ 方向键 → 
        if ((e.altKey) && ((k == 37) || (k == 39))) {
            alert("不准你使用ALT+方向键前进或后退网页!")
            e.keyCode = 0
            e.returnValue = false
            e.cancelBubble = true
            return false
        }
    };
    //屏蔽右键菜单
    document.oncontextmenu = function(event) {
        if (window.event) {
            event = window.event
        }
        try {
            var the = event.srcElement
            if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) {

                return false
            }
            return true
        } catch (e) {
            return false
        }
    };