网页源码防扒代码合集

网页源码防扒代码合集,备份收藏防止遗忘丢失

网页源码防扒代码合集,备份收藏,以防遗忘丢失

1.禁用浏览器右键菜单

document.oncontextmenu = new Function("return false;");

2.监听键盘事件

document.onkeydown = document.onkeyup = document.onkeypress = function(event) {
var e = event || window.event || arguments.callee.caller.arguments[0];
if (e && e.keyCode == 123) {
window.location = 'about: blank';
e.returnValue = false;
return (false);
}
}

3.检测控制台

function mAlert() {
var fn = function () {};
fn.toString = function () {
window.location = 'about: blank';
console.log("呵呵");
}
console.log("%c", fn);//请不要删除这行
};mAlert();

4.鼠标点击事件

 
document.onmousedown = function mdClick(event) {
var e = event || window.event || arguments.callee.caller.arguments[0];
if (e.button == 2 || e.button == 3) {
alert("呵呵");
//不建议用以下方法,易错率大
window.location = 'about: blank';
}
}

5.禁止保存

document.onkeydown = function() {
if ((e.ctrlKey) && (e.keyCode == 83)) { //ctrl+s
alert("ctrl+s被禁用");
return false;
}
}

6.css禁止左键右键

//左键
〈body onselectstart="return false"〉


//右键
〈body οncοntextmenu='return false'〉

给TA打赏
共{{data.count}}人
人已打赏
技术教程网站优化资源分享

WordPress插件 火箭缓存加速-WP Rocket v3.12.0.5 专业版+破解+中文汉化

2022-9-8 22:41:36

其他文章技术教程网站优化

WordPress常用函数收集

2022-9-10 16:54:42

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索
本站托管于柠檬云柠檬云