js 禁止复制,另存为,打印,查看源文件
2011-08-26 13:07
453 查看
锁定右键
一点要锁定右键,这里是为了兼容所有的浏览器,尤其是FF,不然FF可以复制
<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()">
拒绝另存
在和之间加入如下代码:
<noscript><iframe src="/*>";</iframe></noscript>
禁止查看源代码
尽管通过以上方式屏蔽了右键查看源文件,拒绝了复制和另存,但通过工具栏的【查看】-【源文件】仍会使网页失锁
要彻底禁止查看源文件,可通过零框架技术解决——将页面分为左右两帧,左帧的宽度为0,载入空页面文件“null.htm”;右帧载入要保护代码的页面,框架面页为index.htm,代码如下:
<html>
<head> <title>欢迎光临--笑申博客--</title> </head>
<frameset cols="0,*" frameborder="NO" border="0" framespacing="0">
<frame src="/null.htm" name="leftFrame" scrolling="NO" noresize>
<frame src="/index.html" name="mainFrame">
</frameset><noframes></noframes>
</html>
同时,框架分2部分 ,为了防止index.html被单独打开,还需要在index.html 加入如下代码
<script language="javascript"> if(top==self)top.location="index.html" </script>
***//防止被别人框架~~~~~~~~~~~~~~~
<SCRIPT language=javascript>
if (top.location != self.location){top.location=self.location; }
</SCRIPT>
禁止打印
<style>@media print{body{display:none}}</style>
一点要锁定右键,这里是为了兼容所有的浏览器,尤其是FF,不然FF可以复制
<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()">
拒绝另存
在和之间加入如下代码:
<noscript><iframe src="/*>";</iframe></noscript>
禁止查看源代码
尽管通过以上方式屏蔽了右键查看源文件,拒绝了复制和另存,但通过工具栏的【查看】-【源文件】仍会使网页失锁
要彻底禁止查看源文件,可通过零框架技术解决——将页面分为左右两帧,左帧的宽度为0,载入空页面文件“null.htm”;右帧载入要保护代码的页面,框架面页为index.htm,代码如下:
<html>
<head> <title>欢迎光临--笑申博客--</title> </head>
<frameset cols="0,*" frameborder="NO" border="0" framespacing="0">
<frame src="/null.htm" name="leftFrame" scrolling="NO" noresize>
<frame src="/index.html" name="mainFrame">
</frameset><noframes></noframes>
</html>
同时,框架分2部分 ,为了防止index.html被单独打开,还需要在index.html 加入如下代码
<script language="javascript"> if(top==self)top.location="index.html" </script>
***//防止被别人框架~~~~~~~~~~~~~~~
<SCRIPT language=javascript>
if (top.location != self.location){top.location=self.location; }
</SCRIPT>
禁止打印
<style>@media print{body{display:none}}</style>
相关文章推荐
- 网页源代码保护(禁止右键、复制、另存为、查看源文件)
- 网页源代码保护(禁止右键、复制、另存为、查看源文件)
- 网页源代码保护(禁止右键、复制、另存为、查看源文件)
- 网页源代码保护(禁止右键、复制、另存为、查看源文件)
- 网页禁止右键、禁止查看源代码、禁止复制和另存为的代码
- js禁止复制,右键,选择,禁止另存为
- JS应用之禁止抓屏、复制、打印
- JS应用之禁止抓屏、复制、打印
- JS应用之禁止抓屏、复制、打印
- 网站内容禁止复制和粘贴、另存为的js代码
- 禁止复制代码禁止保持禁止查看源文件的代码保护和破解
- 禁止另存为 禁止复制 禁止右键 JS
- 【转】js禁止抓屏, 复制, 打印
- js网页禁止复制-禁止另存为-禁止选择-禁止鼠标右键代码
- JS禁用右键、禁止选择文本、禁用打印、防止另存为
- html中禁止网页另存为、查看源文件、屏蔽鼠标右键
- 网站内容禁止复制和粘贴、另存为的js代码
- JS实现网站内容的禁止复制和粘贴、另存为
- 网站内容禁止复制和粘贴、另存为的js代码
- JS禁止右键、CTRL+C、查看源文件