JS 禁止网页的复制粘贴以及打开F12

//禁止用户复制粘贴
    forbid(){

      var noright = "";
      if(!noright){
        document.onselectstart=function(){return false;}; //禁止复制粘贴
        window.oncontextmenu=function(){return false;} //禁止右键点击时间
        window.onkeydown = window.onkeyup = window.onkeypress = function (event) { //禁止打开F12
          if(event.code == 'F12'){
            window.event.returnValue = false;
            return false;
          }
        }
      }

    },

  

posted @ 2022-03-08 15:21  薛定谔_猫  阅读(262)  评论(0)    收藏  举报