自助广告位pc端/手机端
一元置顶入驻

网站防扒技术合集

教程8个月前发布 壳壳
606 0 0

1.禁用浏览器右键菜单

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

2.监听键盘事件

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

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;
        }
    }

css禁止左键右键

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

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

 

© 版权声明

相关文章

暂无评论

您必须登录才能参与评论!
立即登录
暂无评论...
一键登录开启个人书签等功能!
随便看看