iframe中在父窗口打开子页面

我们在做页面框架的时候,通常会采用一个iframe来显示子页面,但有这么种情况,就是session失效时,登录页面就会显示在iframe中,这不符合常理,一般应该显示在顶部才对。

下面的js代码可以解决上述问题,只需要在登录页面添加如下代码:

  <script type="text/javascript" >
   		/**有父窗口则在父窗口打开*/
   		if(self!=top){top.location=self.location;}
    </script>

  

转自:http://liuna718-163-com.iteye.com/blog/1464168

posted @ 2016-10-14 11:05  Iwin9999  阅读(2101)  评论(0编辑  收藏  举报