终极解决浏览器禁用f12


document.onkeydown =
            document.onkeyup =
            document.onkeypress =
                function (event) {
                    var e =
                        event ||
                        window.event ||
                        arguments.callee.caller.arguments[0];

                    if (e && e.keyCode == 123) {
                        e.returnValue = false;
                        return false;
                    }
                };

        var threshold = 160; // 打开控制台的宽或高阈值
        // 每秒检查一次
        window.setInterval(function () {
            if (
                window.outerWidth - window.innerWidth > threshold ||
                window.outerHeight - window.innerHeight > threshold
            ) {
                window.location.href = "https://i.cnblogs.com/";
            }
        }, 1e3);


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM