之前有发布过网页禁止右键选中粘贴复制等代码,今天补充一些,将所有本人已知的屏蔽代码发出来

/* 屏蔽F12 审查元素 */

    document.onkeydown = function () {
        if (window.event && window.event.keyCode == 123) {
            alert("小样你想干嘛!");
            event.keyCode = 0;
            event.returnValue = false;
        }
        if (window.event && window.event.keyCode == 13) {
            window.event.keyCode = 505;
        }
        if (window.event && window.event.keyCode == 8) {
            alert(str + "\n请使用Del键进行字符的删除操作!");
            window.event.returnValue = 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;
        }
    }
/* 屏蔽粘贴 */
    document.onpaste = 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;
        }
    }
/* 屏蔽复制 */
    document.oncopy = 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;
        }
    }
/* 屏蔽剪切 */
    document.oncut = 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;
        }
    }
/* 屏蔽选中 */
    document.onselectstart = 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;
        }
    }


/* 禁止任何键盘敲击事件(防止F12和shift+ctrl+i调起开发者工具) */

    window.onkeydown = window.onkeyup = window.onkeypress = function () { 
    window.event.returnValue = false; 
        return false; 
    } 
    //如果用户在工具栏调起开发者工具,那么判断浏览器的可视高度和可视宽度是否有改变,如有改变则关闭本页面 
    var h = window.innerHeight,w=window.innerWidth; 
    window.onresize = function () { 
        if (h!= window.innerHeight||w!=window.innerWidth){ 
            window.close(); 
            window.location = "about:blank"; 
        } 
    }

/*只要修改页面元素就重新加载一次数据(不支持IE9以下浏览器)*/

    if(window.addEventListener){ 
        window.addEventListener("DOMCharacterDataModified", function(){window.location.reload();}, true); 
        window.addEventListener("DOMAttributeNameChanged", function(){window.location.reload();}, true); 
        window.addEventListener("DOMCharacterDataModified", function(){window.location.reload();}, true); 
        window.addEventListener("DOMElementNameChanged", function(){window.location.reload();}, true); 
        window.addEventListener("DOMNodeInserted", function(){window.location.reload();}, true); 
        window.addEventListener("DOMNodeInsertedIntoDocument", function(){window.location.reload();}, true); 
        window.addEventListener("DOMNodeRemoved", function(){window.location.reload();}, true); 
        window.addEventListener("DOMNodeRemovedFromDocument", function(){window.location.reload();}, true); 
        window.addEventListener("DOMSubtreeModified", function(){window.location.reload();}, true); 
    } 

总来说,这些代码只能起到防小白偷代码,调起审查的方法还有很多,例如:新建空白网页,首先F12,之后输入网站地址也是可以的

这些代码都是js直接浏览器禁用javascript一样会导致上面代码全失效

最后代码来源网络,由博主发布,如有侵权联系我立即删除!