伯克 法国革命论 pdf:如何使网页不能查看源文件也不能另存为?

来源:百度文库 编辑:高考问答 时间:2024/05/09 19:45:46
如何使网页不能查看源文件也不能另存为?
谁能提供完整语句吗?

简单的:
在页面插入如下代码:
<noscript>
<iframe src="*.html;*.htm;*.mht;*.txt"> </iframe>
</noscript>防止另存为
下面防右键
<SCRIPT>
//
function rf()
{return false; }
document.oncontextmenu = rf
function keydown()
{if(event.ctrlKey ==true || event.keyCode ==93 || event.shiftKey ==true){return false;} }
document.onkeydown =keydown
function drag()
{return false;}
document.ondragstart=drag
function stopmouse(e) {
if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2))
return false; }
document.onmousedown=stopmouse;
if (document.layers)
window.captureEvents(Event.MOUSEDOWN);
window.onmousedown=stopmouse;

</SCRIPT>

以上为简单的保护设置。

有效的解决:

<%
response.write"网页源代码"
%>

写个JavaScript脚本就可以了:
<script language="javascript">

function click(){

if (event.button==2){}

document.onmousedown=cilck

</script>

只要有工具栏就没有查不了的源码
楼上的办法只能屏蔽鼠标右键的察看,但IE工具栏的你能屏蔽吗?
不让别人另存很简单
在里面加上这样的代码
<IFRAME src='*' Width='0' Height='0'></IFRAME></NOSCRIPT><NOSCRIPT><IFRAME src='*' Width='0' Height='0'></IFRAME></NOSCRIPT>

随便找个位置就行
我习惯放最下面了

禁示查看源代码
我们已经禁了右键,但从"查看"菜单下的"源文件"中同样可以看到源代码,下面我们就来解决这个问题:
其实这只要使用一个含有<frame></frame>标记的网页便可以达到目的。

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

这样当有人使用"查看"下的"源文件"的时候,看到的将是上面的那段代码,而你真正的文件又躲过一劫。

禁示另存为
通过上面的两步好像你的源代码已经安全了,但别忘了,别人还可以将你的页面保存下来,再慢慢分析。不过别担心,下面我们来解决这个问题。
在你要保密的网页中加入以下代码:

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

<body topmargin="0" leftmargin="0" bgcolor="#FFFFFF" onselectstart="return false" oncopy="return false;" oncut="return false;" oncontextmenu="window.event.returnValue=false">

用asp.net开发