简单的Javascript代码行

时间:2014-04-28 22:14:09

标签: javascript

在我们的大部分网页上都有这行代码,我试图弄清楚它的用途以及我是否可以删除它。

看起来像这样:

<script type="text/javascript">
  /*<![CDATA[*/
  if(top!=self){top.location.replace(self.location.href);}
  /*]]>*/
</script>

我知道这可能是一个愚蠢的问题,但是这一系列的剧本试图说出来。这可能与登录功能有关吗?

提前致谢

1 个答案:

答案 0 :(得分:10)

if (top != self) { // if the top frame isn't this window
    top.location.replace( // set the top frame's location
        self.location.href // to this window's location
    );
}