汇集软件下载,免费分享活动线报
广告招商

解除网页操作限制,解除右键复制等

金腾网小编 0

既然我们要解除就要先看看禁止效果是如何失效的,以下代码放入网站JS里面引用即可实现效果。

// 禁止右键菜单
document.oncontextmenu = function(){ return false; };
document.oncontextmenu= new Function("event.returnValue=false");
// 禁止文字选择
document.onselectstart = function(){ return false; };
document.onselectstart = new Function("event.returnValue=false");
// 禁止复制
document.oncopy = function(){ return false; };
document.oncopy = new Function("event.returnValue=false");
// 禁止剪切
document.oncut = function(){ return false; };
document.oncopy = new Function("event.returnValue=false");
// 禁止粘贴
document.onpaste = function(){ return false; };
document.onpaste = new Function("event.returnValue=false");
// 禁止F12
document.onkeydown = function () {
    if (window.event && window.event.keyCode == 123) {
        event.keyCode = 0;
        event.returnValue = true;
        return true;
    }
};

解除禁止操作

通常直接按F12,如果此键被禁止可以通过SHIFT + CTRL + I打开,或者通过浏览器菜单里面的“开发人员工具”。

选择控制台,输入以下代码回车即可。

// 开启右键菜单
document.oncontextmenu = function(){ return true; };
// 开启文字选择
document.onselectstart = function(){ return true; };
// 开启复制
document.oncopy = function(){ return true; };
// 开启剪切
document.oncut = function(){ return true; };
// 开启粘贴
document.onpaste = function(){ return true; };
// 开启F12键
document.onkeydown = function () {
    if (window.event && window.event.keyCode == 123) {
        event.keyCode = 0;
        event.returnValue = true;
        return true;
    }
};

标签:

暂无标签

免责声明:

本站提供的资源,都来自网络,版权争议与本站无关,所有内容及软件的文章仅限用于学习和研究目的。不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负,我们不保证内容的长久可用性,通过使用本站内容随之而来的风险与本站无关,您必须在下载后的24个小时之内,从您的电脑/手机中彻底删除上述内容。如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。侵删请致信E-mail: 34585055@qq.com

同类推荐
评论列表
签到