終極解決瀏覽器禁用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