frame框架-用户session失效仅在iframe中跳转登录页面的解决方法

来源:互联网 发布:网络空间拟态安全防御 编辑:程序博客网 时间:2024/04/20 04:34

在写页面中我们经常用到frame进行页面框架结构的编写,但是在使用frame时经常会 出现一个问题。比如如果在页面中用户session失效,在点击frame中的按钮时,会被拦截器拦截,并跳转到登录页面,但是仅是当前frame跳转,其他frame并没有跳转。

解决方法:

可以再登录页面 login.jsp 中添加如下js代码:

<script type="text/javascript"> 
     if(top!=self){
          if(top.location != self.location)
               top.location=self.location; 
     }
</script>

0 0
原创粉丝点击