Blocking F12 and Inspect Element on a Web Page

Machine-translated (anthropic, claude-haiku-5-5) from the Chinese original. Read the original in 中文

When a gentleman someone presses F12 or right-clicks to inspect an element, the website turns into a blank page. A single JavaScript snippet is all it takes. Insert the code below before the </body> tag of the website. (Unfortunately, it isn't compatible with IE, and reportedly not with Firefox either, so test it yourself. It should definitely work with the Chrome engine, so it can only be used to deter beginners or gentlemen.)

javascript
<script>
//防止小白F12
function fuckyou(){
      window.close(); //关闭当前窗口(防抽)
     window.location="about:blank"; //将当前窗口跳转置空白页
}
  function ck() {
    console.profile();
    console.profileEnd();
    //我们判断一下profiles里面有没有东西,如果有,肯定有人按F12了,没错!!
    if(console.clear) { console.clear() };
                        if (typeof console.profiles =="object"){
    return console.profiles.length > 0;
                        }
}
function hehe(){
if( (window.console && (console.firebug || console.table && /firebug/i.test(console.table()) )) || (typeof opera == 'object' && typeof opera.postError == 'function' && console.profile.length > 0)){
  fuckyou();
}
if(typeof console.profiles =="object"&&console.profiles.length > 0){
fuckyou();
}
}
hehe();
window.onresize = function(){
if((window.outerHeight-window.innerHeight)>200)
//判断当前窗口内页高度和窗口高度,如果差值大于200,那么呵呵
   fuckyou();
}
</script>

Reposted from: 亲爱的娜 《网页禁止F12、审查元素》 https://www.dearna.com.cn/archives/241/

Comments