加载中...

网页禁止查看审查元素及复制粘贴

网页禁止查看审查元素及复制粘贴

2025-02-18 22:43:40   79   0
//禁用F12window.onkeydown = window.onkeyup = window.onkeypress = function (event) {    // 判断是否按下F12,F12键码为123
    if (event.keyCode == 123) {
    event.preventDefault(); // 阻止默认事件行为
        window.event.returnValue = false;
    }
}
//禁用调试工具var threshold = 160; // 打开控制台的宽或高阈值// 每秒检查一次var check = setInterval(function() {    if (window.outerWidth - window.innerWidth > threshold || 
        window.outerHeight - window.innerHeight > threshold) {        // 如果打开控制台,则刷新页面
        window.location.reload();
    }
}, 1000)
//屏蔽右键菜单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.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;
    }
}
//屏蔽复制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.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;
    }
}





喜欢就支持一下吧

版权说明:

本站永久网址:http://blog.xqynet.cn

本网站的文章部分内容可能来源于网络,仅供大家学习与参考,如有侵权,请联系站长 QQ3270361156进行删除处理。

本站一切资源不代表本站立场,并不代表本站赞同其观点和对其真实性负责。

评论
目前暂无评论,快抢个位置吧