`
sammyfun
  • 浏览: 1161460 次
  • 性别: Icon_minigender_1
  • 来自: 西安
社区版块
存档分类
最新评论

JS 跳出iframe框架

阅读更多
友情提示
TabPanel的属于里layoutOnTabChange:true,这个是一定要加的
每一个tab的布局用着fit。
或者tab用bordel布局..grid设成region:'center'


JS 跳出iframe框架,退出JS 2010-10-18 15:31:57 阅读348 评论1   字号:大中小 订阅
(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>




跳出多级iframe
我知道一个ifame中的跳出框架的方法
JScript code



function gotoLogin(){

if(self.frameElement && self.frameElement.tagName=="FRAME"){

// 页面在iframe中时处理

window.parent.location = "${pageContext.request.contextPath}/login.jsp";

}else{

window.location = "${pageContext.request.contextPath}/login.jsp";

}

}





但是我ifame中又套了一个ifame 这个页面如何跳出啊?


我的页面流程是超时显示超时页面--》点击链接回到登陆页面
--------------------------------------------------------------------------------
二楼正解~~~


--------------------------------------------------------------------------------
搞定结贴!
JScript code



function gotoLogin(){

var t = self.frameElement;

if(t && (t.tagName=="FRAME"||t.tagName=="IFRAME")){

// 页面在iframe中时处理

window.top.location = "${pageContext.request.contextPath}/login.jsp";

}else{

window.location = "${pageContext.request.contextPath}/login.jsp";

}

}



分享到:
评论
1 楼 jpsb 2014-04-14  
感谢!

相关推荐

Global site tag (gtag.js) - Google Analytics