iframe内嵌页面跳转时主页面时跳到页面顶部的解决方法

来源:互联网 发布:阿里网络银行 编辑:程序博客网 时间:2024/05/16 15:52


(1)session过期后登陆页面跳出iframe页面问题
登陆页面增加javascript:
function window.onload()
    {
        if(window.parent.length>0)
         window.parent.location=location;
    }

或者:

<script>

if (window != top)
top.location.href = location.href;

</script>


(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>

0 0
原创粉丝点击