我们在做系统的时候,尤其是一个页面一个系统的哪种,往往我们通过弹出window里面嵌套iframe来整合其他页面,我们会常常碰见如果session失效的时候,当前的iframe页面为登陆页面,按照常理应该是父页面为登陆页面才对,针对此问题给出了个解决方案。
代码如下:
就是让最顶端的location为当前的location地址
$(function(){
try{
top.location.hostname;
if (top.location.hostname != window.location.hostname) {
top.location.href =window.location.href;
}
}
catch(e){
top.location.href = window.location.href;
}
});
iframe登录页同步方案
1961

被折叠的 条评论
为什么被折叠?



