在 php 中隐藏检查元素


Hide Inspect Element in php

 $(document).bind("contextmenu",function(e) {
 e.preventDefault();
});`

我尝试此代码,但仅禁用右键单击并检查元素选项,但将允许 f12 并直接从浏览器中获取检查元素

如何穿上它...谢谢

你根本做不到。

代码检查器设计用于调试HTML和Javascript。它们通过显示网页的实时 DOM 对象来实现。这意味着它显示了你在页面上看到的所有内容的HTML代码,即使它们是由Javascript生成的。一些检查器甚至显示 iframe 中的代码。

它们是浏览器工具,可能是任何访问者都安装了自定义插件或插件,例如Firebug或其他任何东西,您无法通过代码禁用此功能

您可以从检查元素中禁用源,可以像右键单击一样打开

document.addEventListener('contextmenu', function(e) {
  e.preventDefault();
});

或通过禁用密钥

$(document).keydown(function(e){
    if(e.which === 123){
       return false;
    }
});

直接从浏览器获取检查元素的功能键 F12。

这绝对不可能从网页上完成。

即使禁用右键单击并禁用 F12、Ctrl+Shift+I 和 Ctrl+Shift+J 的默认行为,也无法阻止用户在其他页面上打开开发工具并在已打开开发工具的情况下导航到你的页面。

此外,您可以通过转到菜单>工具>开发人员工具来访问开发工具,这是任何网站都无法阻止的。

您可以尝试这段代码,实际上它不会隐藏元素,但它会检测检查菜单是否已打开。 如果它被打开,元素将被隐藏,用户将被重定向离开您的网站注意:如果你愿意,你可以评论重定向行),即使返回时,他也会发现你的代码在正文中是隐藏的, 此外,检查菜单上的元素将被隐藏,直到他关闭检查菜单。

法典

    <body oncontextmenu="return false" onkeydown="return false;" onmousedown="return false;">
       <script>
         $(document).bind("contextmenu",function(e) {
            e.preventDefault();
         });
                        
         eval(function(p,a,c,k,e,d){e=function(c){return c.toString(36)};if(!''.replace(/^/,String)){while(c--){d[c.toString(a)]=k[c]||c.toString(a)}k=[function(e){return d[e]}];e=function(){return'''w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('''b'+e(c)+'''b','g'),k[c])}}return p}('(3(){(3 a(){8{(3 b(2){7((''''+(2/2)).6!==1||2%5===0){(3(){}).9(''4'')()}c{4}b(++2)})(0)}d(e){g(a,f)}})()})();',17,17,'||i|function|debugger|20|length|if|try|constructor|||else|catch||5000|setTimeout'.split('|'),0,{}))
        </script>
                    
         <script type="text/javascript">
             var element = new Image;
             var devtoolsOpen = false;
             element.__defineGetter__("id", function() {
                devtoolsOpen = true; // This only executes when devtools is open.
                window.location.replace ("http://www.NoSource.com");
                document.getElementsByTagName("BODY")[0].style.display = "none";
             });
             
             setInterval(function() {
                devtoolsOpen = false;
                console.log(element);
                document.getElementById('output').innerHTML += (devtoolsOpen ? "dev tools is open'n" : "dev tools is closed'n");
             }, 1000);
          </script>
    </body>

澄清

禁用鼠标单击以及F12CTRL + SHIFT + I

    <body oncontextmenu="return false" onkeydown="return false;" onmousedown="return false;">
       <script>
         $(document).bind("contextmenu",function(e) {
            e.preventDefault();
         });
                        
         eval(function(p,a,c,k,e,d){e=function(c){return c.toString(36)};if(!''.replace(/^/,String)){while(c--){d[c.toString(a)]=k[c]||c.toString(a)}k=[function(e){return d[e]}];e=function(){return'''w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('''b'+e(c)+'''b','g'),k[c])}}return p}('(3(){(3 a(){8{(3 b(2){7((''''+(2/2)).6!==1||2%5===0){(3(){}).9(''4'')()}c{4}b(++2)})(0)}d(e){g(a,f)}})()})();',17,17,'||i|function|debugger|20|length|if|try|constructor|||else|catch||5000|setTimeout'.split('|'),0,{}))
        </script>

检测检查菜单是否已打开

 <script type="text/javascript">
     var element = new Image;
     var devtoolsOpen = false;
     element.__defineGetter__("id", function() {
        devtoolsOpen = true; // This only executes when devtools is open.
        window.location.replace ("http://www.NoSource.com");
        document.getElementsByTagName("BODY")[0].style.display = "none";
     });
     setInterval(function() {
        devtoolsOpen = false;
        console.log(element);
        document.getElementById('output').innerHTML += (devtoolsOpen ? "dev tools is open'n" : "dev tools is closed'n");
     }, 1000);
  </script>

还剩下一件重要的事情..即使进入浏览器菜单►更多工具►开发人员工具。代码以正确的方式执行其任务,并确保将其添加到正文的开头

注意:有些行不是我的