下面这句代码在Login页面里,它有什么用啊?如何解释它?

来源:百度知道 编辑:UC知道 时间:2024/06/23 01:25:29
<script language="JavaScript">
<!--
if (self != top) top.location.href = window.location.href
//-->
</script>

防止别人用<iframe>....</frame>,
把自己的网页变成别人网页的一部分,
举个实例:
页面shiyishi.htm
<html>
<head><head>
<body>
<iframe width="500" height="500" src="shiyishi.html></iframe></body><html>
这样shiyishi.htm就会在这个框架显示
假如在shiyishi.htm中加上代码
<script language="JavaScript">
<!--
if (self != top) top.location.href = window.location.href
//-->
</script>
你在看看效果,就会显示跳到shiyishi.htm页面
shiyishi.htm就不会被别人框住了

这东西实用么,第一次看到