首页 > 编程 > JS > 正文

如何防止别人看到自己的源代码

2023-04-13 12:30:07
字体:
来源:转载
供稿:网友

<html>
<head>
   <script language="javascript">
      function clear(){
          Source=document.body.firstChild.data;
          document.open();
          document.close();
          document.title="看不到源代码";
          document.body.innerHTML=Source;
}
</script>
</head>
<body onload=clear()>
<!--
这招算是目前网上公布的防止查看源代码的方法中最好的了,当然了,要看还是办法的,比如在地址栏中输入<br>
javascript:alert(document.documentElement.outerHTML);
-->
</body>
</html>

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表