前端页面禁止调试debugger方法汇总
本文最后更新于 1336 天前,其中的信息可能已经有所发展或是发生改变。

打开控制台直接跳转页面

//debug调试时跳转页面
var element = new Image();
Object.defineProperty(element,'id',{get:function(){window.location.href="https://www.baidu.com"}});
console.log(element);

打开控制台,页面内容显示"检测到非法调试,请关闭后刷新重试!"

// 反调试函数,参数:开关,执行代码
function endebug(off, code) {
    if (!off) {
        ! function (e) {
            function n(e) {
                function n() {
                    return u;
                }

                function o() {
                    window.Firebug && window.Firebug.chrome && window.Firebug.chrome.isInitialized ? t("on") : (a = "off", console.log(d), console.clear(), t(a));
                }

                function t(e) {
                    u !== e && (u = e, "function" == typeof c.onchange && c.onchange(e));
                }

                function r() {
                    l || (l = !0, window.removeEventListener("resize", o), clearInterval(f));
                }
                "function" == typeof e && (e = {
                    onchange: e
                });
                var i = (e = e || {}).delay || 500,
                    c = {};
                c.onchange = e.onchange;
                var a, d = new Image;
                d.__defineGetter__("id", function () {
                    a = "on"
                });
                var u = "unknown";
                c.getStatus = n;
                var f = setInterval(o, i);
                window.addEventListener("resize", o);
                var l;
                return c.free = r, c;
            }
            var o = o || {};
            o.create = n, "function" == typeof define ? (define.amd || define.cmd) && define(function () {
                return o
            }) : "undefined" != typeof module && module.exports ? module.exports = o : window.jdetects = o
        }(), jdetects.create(function (e) {
            var a = 0;
            var n = setInterval(function () {
                if ("on" == e) {
                    setTimeout(function () {
                        if (a == 0) {
                            a = 1;
                            setTimeout(code);
                        }
                    }, 200);
                }
            }, 100);
        })
    }
}

endebug(false, function () {
    // 非法调试执行的代码(不要使用控制台输出的提醒)
    // document.write("检测到非法调试,请关闭后刷新重试!");
    document.write('<h1 style="font-size:36px;color:red;text-align:center;margin-top:30vh;">检测到非法调试,请关闭调试后刷新页面进行阅读!</h1>');
});

参考

  1. 前端页面禁止调试debugger方法汇总
标题:前端页面禁止调试debugger方法汇总
地址:https://xiaodongxier.com/247.html
作者:王永杰
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇