背景:
父页面 index.html 布局,左侧为菜单,右侧通过 iframe 渲染主体内容,当session会话过期时,会跳转到 login.html 登录页面,导致父页面仍为已登录的样式,正确情况应该父级页面直接跳转到登录页。
解决:
在 login.html 登录页面添加以下js代码
var _thiswindow = window;
while (_thiswindow != _thiswindow.parent.window) {
_thiswindow = _thiswindow.parent.window;
}
if (window != _thiswindow){
_thiswindow.window.location.href = "{:url('/login')}";
}