js代码屏蔽右键及 F12

版权声明:本文为博主落尘曦的原创文章。如转载请注明链接 【 落尘曦的博客:http://blog.csdn.net/qq_23994787 】感谢配合! https://blog.csdn.net/qq_23994787/article/details/86607334

屏蔽右键

window.onload=function(){
    document.onkeydown=function(){
        var e=window.event||arguments[0];
        if(e.keyCode==123){
            return false;
        }
        if((e.ctrlKey) && (e.keyCode==67)){
            return false;
        }
        if((e.ctrlKey) && (e.keyCode==65)){
            return false;
        }
        if((e.ctrlKey) && (e.keyCode==85)){
            return false;
        }

        if((e.ctrlKey)&&(e.shiftKey)&&(e.keyCode==67)){
            return false;
        }
        if((e.ctrlKey)&&(e.shiftKey)&&(e.keyCode==65)){
            return false;
        }
    };
    document.oncontextmenu=function(){
        return false;
    }
}

解除右键

javascript:(function() { function R(a){ona = "on"+a; if(window.addEventListener) window.addEventListener(a, function (e) { for(var n=e.originalTarget; n; n=n.parentNode) n[ona]=null; }, true); window[ona]=null; document[ona]=null; if(document.body) document.body[ona]=null; } R("contextmenu"); R("click"); R("mousedown"); R("mouseup"); R("selectstart");})() 

将以上网址存为书签,在无法使用右键的网页点击一下即可。

猜你喜欢

转载自blog.csdn.net/qq_23994787/article/details/86607334