互联网页面浏览限制实现总结 (2)

- 中国WEB开发者网络 (http://www.webasp.net)
-- 技术教程 (http://www.webasp.net/article/)
--- 互联网页面浏览限制实现总结 (2) (http://www.webasp.net/article/28/27055.htm)
-- 作者:未知
-- 发布日期: 2005-11-18
2.不能展开右键,不能全选,不能复制的实现
<body oncontextmenu="window.event.returnValue=false" 

onkeypress="window.event.returnValue=false" 

onkeydown="window.event.returnValue=false" 

onkeyup="window.event.returnValue=false" 

ondragstart="window.event.returnValue=false" 

onselectstart="event.returnValue=false">
... 

</body>


3.禁止页面正文内容被选取

<body oncontextmenu="return false" ondragstart="return false" 
onselectstart ="return false" onselect="document.selection.empty()" 
oncopy="document.selection.empty()" onbeforecopy="return 

false"onmouseup="document.selection.empty()">


4.避免别人把网页放在框架中

<script language=“javascript”><!--if (self!=top){top.location=self.location;}-->< /script>


5.禁示查看源代码

<frameset> 

<frame src="你要保密的文件的URL"> 

</frameset>


6.关闭输入法

<input style="ime-mode:disabled">


7.禁止图片下载

这里的最后加入:

oncontextmenu="return false" ondragstart="return false" onselectstart="return 
false" scroll="auto"


8.禁止缓存

在HEAD里加入:

<meta http-equiv="Expires" CONTENT="0"> 

<meta http-equiv="Cache-Control" CONTENT="no-cache"> 


<meta http-equiv="Pragma" CONTENT="no-cache">



webasp.net