(文章转载来自闲鱼博客)有个神奇的东西叫做审查元素,按下神奇的F12,就是见证奇迹的时刻。审查元素真的是一个强大功能,有的时候看中别人网站的某个样式做的比较好,按下F12审查元素来查看别人的代码,统统扒过来。那么如果防止别人查看自己网站的代码,扒代码呢,这里闲鱼就分享两种还不错的防F12代码,当然,也只是防新手而已心理安慰 一、防F12扒代码:按下F12关闭当前页面 使用方法:添加到footer。php即可,不过貌似这个能破解,哈哈。 functionfuckyou(){ window。close();关闭当前窗口(防抽) window。location“about:blank”;将当前窗口跳转置空白页 } functionck(){ console。profile(); console。profileEnd(); 我们判断一下profiles里面有没有东西,如果有,肯定有人按F12了,没错!! if(console。clear){console。clear()}; if(typeofconsole。profiles“object”){ returnconsole。profiles。length0; } } functionhehe(){ if((window。console(console。firebugconsole。tablefirebugi。test(console。table())))(typeofopera‘object’typeofopera。postError‘function‘console。profile。length0)){ fuckyou(); } if(typeofconsole。profiles“object”console。profiles。length0){ fuckyou(); } } hehe(); window。onresizefunction(){ if((window。outerHeightwindow。innerHeight)200) 判断当前窗口内页高度和窗口高度,如果差值大于200,那么呵呵 fuckyou(); } 二、防F12扒代码:按下F12画面卡死 使用方法:添加到footer。php即可,这个也能破解,感觉这个更牛一点。来自inlojv。 functioninlobasenoF12(){while(1){}}functioninlojvconsole(){if((window。console(console。firebugconsole。tablefirebugi。test(console。table())))(typeofopera“object”typeofopera。postError“function”console。profile。length0)){inlobasenoF12()}if(typeofconsole。profiles“object”console。profiles。length0){inlobasenoF12()}}inlojvconsole();window。onresizefunction(){if((window。outerHeightwindow。innerHeight)200){inlobasenoF12()}};