只要按下那神秘的审查元素、按下那神秘的F12键,奇迹出现了!
网站变成了空白页,可谓杀防君子放火必备佳品!

防F12扒代码:按下F12关闭当前页面

只要按下那神秘的审查元素、按下那神秘的F12键,奇迹出现了!网站变成了空白页,可谓杀防君子放火必备佳品!一段JavaScript代码即可实现上述功能,插入到 footer.php</body> 前:

<script>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>

[js]禁止鼠标右键代码

1、禁止鼠标左右键代码/禁止网页选中/禁止另存为/防复制代码

<body oncontextmenu="return false"onselectstart="return false">
<noscript><iframe src="/*.html>";</iframe></noscript>
<script>
functionstop(){
returnfalse;
}
document.oncontextmenu=stop;
</script>

2、禁止鼠标左右键

<SCRIPT language=javascript>
<!--
if(window.Event)
document.captureEvents(Event.MOUSEUP);
functionnocontextmenu(){
event.cancelBubble=true
event.returnValue=false;
returnfalse;
}
functionnorightclick(e){
if(window.Event){
if(e.which==2||e.which==3)
returnfalse;
}
else
if(event.button==2||event.button==3){
event.cancelBubble=true
event.returnValue=false;
returnfalse;
}
}
document.oncontextmenu=nocontextmenu;// for IE5+
document.onmousedown=norightclick;// for all others
//-->
</SCRIPT>

3、禁止选中代码

<SCRIPT language=JavaScript>
document.oncontextmenu=newFunction("event.returnValue=false;");
document.onselectstart=newFunction("event.returnValue=false;");
</SCRIPT>

4、禁止另存为

<noscript>
<iframe src="/*.htm"></iframe>
</noscript>

5、防拷贝/复制代码

<body leftmargin=0topmargin=0>

6、禁止选择文本

<script type="text/javascript">
varomitformtags=["input","textarea","select"]
omitformtagsomitformtags=omitformtags.join("|")
functiondisableselect(e){
if(omitformtags.indexOf(e.target.tagName.toLowerCase())==-1)
returnfalse
}
functionreEnable(){
returntrue
}
if(typeofdocument.onselectstart!="undefined")
document.onselectstart=newFunction("return false")
else{
document.onmousedown=disableselect
document.onmouseup=reEnable
}
</script>

7、禁止网页另存为:

<noscript><iframe src="/*.html>";</iframe></noscript>

8、禁止选择文本:

<script type="text/javascript">
 
varomitformtags=["input","textarea","select"]
 
omitformtagsomitformtags=omitformtags.join("|")
 
functiondisableselect(e){
if(omitformtags.indexOf(e.target.tagName.toLowerCase())==-1)
returnfalse
}
 
functionreEnable(){
returntrue
}
 
if(typeofdocument.onselectstart!="undefined")
document.onselectstart=newFunction("return false")
else{
document.onmousedown=disableselect
document.onmouseup=reEnable
}
</script>

9、禁用右键:

<script>
functionstop(){
returnfalse;
}
document.oncontextmenu=stop;
</script>

10、真正的鼠标右键屏蔽

<script language="JavaScript">
<!--
 
if(window.Event)
document.captureEvents(Event.MOUSEUP);
 
functionnocontextmenu()
{
event.cancelBubble=true
event.returnValue=false;
 
returnfalse;
}
 
functionnorightclick(e)
{
if(window.Event)
{
if(e.which==2||e.which==3)
returnfalse;
}
else
if(event.button==2||event.button==3)
{
event.cancelBubble=true
event.returnValue=false;
returnfalse;
}
 
}
 
document.oncontextmenu=nocontextmenu;// for IE5+
document.onmousedown=norightclick;// for all others
//-->
</script>


如题目所说,开心就好

网页禁用右键我见过,禁用 F12 是如何实现的?

标签:右键, JavaScript, F12

你的评论