你可以试试这段代码,实际上它并没有隐藏元素,而是检测检查菜单是否打开。如果打开,元素将被隐藏,用户将被重定向离开您的网站(注意:您可以根据需要评论重定向行),即使返回他会发现你在正文中的代码被隐藏了,并且检查菜单上的元素也将被隐藏,直到他关闭检查菜单。
代码
<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>
澄清
禁用鼠标点击和F12 和CTRL + 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>
还有一件重要的事情.. 即使在进入浏览器菜单 ► 更多工具 ► 开发人员工具.. 代码以正确的方式执行其任务,并确保将其添加到你身体的开始
注意:有些行不是我的