打印本文 打印本文 关闭窗口 关闭窗口
禁止查看网页源代码之JavaScript源代码
作者:武汉SEO闵涛  文章来源:敏韬网  点击数865  更新时间:2009/6/9 2:31:04  文章录入:mintao  责任编辑:mintao

1、将以下代码加入到HEML的之间

        以下是引用片段:
<SCRIPT language=javascript>
function click() {if (event.button==2) {alert('不许你偷看!');}}document.onmousedown=click
</SCRIPT> 


2、禁止查看网页源代码

  真正能实现源代码屏蔽的单纯的.htm是不可能的!想看源代码是没办法阻止的。用TELEPROT可以下载任何文件,相当于做镜像网站,

  除非服务器进行安全设置、加密。

  下面给几种参考方法,使在浏览我的个人主页时不能使用右键。

  在主页上输入代码:

        以下是引用片段:

<script language="JavaScript">
<!--

if (window.Event) 
document.captureEvents(Event.MOUSEUP); 

function nocontextmenu() 
{
event.cancelBubble = true
event.returnValue = false;

return false;
}

function norightclick(e) 
{
if (window.Event) 
{
if (e.which == 2 || e.which == 3)
return false;
}
else
if (event.button == 2 || event.button == 3)
{
event.cancelBubble = true
event.returnValue = false;
return false;
}

}

document.oncontextmenu = nocontextmenu; // for IE5+
document.onmousedown = norightclick; // for all others
//-->
</script> 

 

打印本文 打印本文 关闭窗口 关闭窗口