1.引入disable-devtool

<script disable-devtool-auto src='https://cdn.jsdelivr.net/npm/disable-devtool/disable-devtool.min.js'></script>

2. 屏蔽按键

<script type='text/javascript'> 
    //禁用右键(防止右键查看源代码) 
    window.oncontextmenu=function(){return false;} 
    //禁止任何键盘敲击事件(防止F12和shift+ctrl+i调起开发者工具) 
    window.onkeydown = window.onkeyup = window.onkeypress = function () { 
    window.event.returnValue = false; 
        return false; 
    } 
    //如果用户在工具栏调起开发者工具,那么判断浏览器的可视高度和可视宽度是否有改变,如有改变则关闭本页面 
    var h = window.innerHeight,w=window.innerWidth; 
    window.onresize = function () { 
        if (h!= window.innerHeight||w!=window.innerWidth){ 
            window.close(); 
            window.location = "about:blank"; 
        } 
    } 
</script>

3. 无限debugger

<script>
      setInterval(function() {
        check();
      }, 2000);
      var check = function() {
        function doCheck(a) {
          if (('' + a / a)['length'] !== 1 || a % 20 === 0) {
            (function() {}['constructor']('debugger')());
          } else {
            (function() {}['constructor']('debugger')());
          }
          doCheck(++a);
        }
        try {
          doCheck(0);
        } catch (err) {}
      };
      check();
 </script>