解决session过期跳转到登陆页面并跳出iframe框架
可以用javaScript解决
在你想控制跳转的页面,比如login.jsp中的<head>与</head>之间加入以下代码:
<script language="JavaScript">
if (window != top)
top.location.href = location.href;
</script>
则在系统超时想在框架中打开登录页时,则login.jsp自身进行判断后跳出iframe等框架要。
(1)session过期后登陆页面跳出iframe页面问题
登陆页面增加javascript:
function window.onload(){
if(window.parent.length>0)
window.parent.location=location;
}
或者:
if (window != top){
top.location.href = location.href;
}
(2)自动跳出iframe的代码
<script type="text/javascript">
if (top.location !== self.location) {
top.location=self.location;
}
</script>
(3)在框架页内的退出操作:
<script type="text/javascript">
if (top.location !== self.location) {
top.location = "../index.jsp";//跳出框架,并回到首页
}
</script>
后续有很多开发填坑的文章发布,如果对你有帮助,请支持和加关注一下
http://e22a.com/h.05ApkG?cv=AAKHZXVo&sm=339944
https://shop119727980.taobao.com/?spm=0.0.0.0