关于 Iframe 的知识

“关闭 “当前的iFrame是不可能的,但你可以告诉父级来操作dom并使其不可见。
In Iframe:
parent.claseIframe();
In parent:
function closeIframe() {
$('#youriframeid').remove();
}

检测iframe的层级,并判断是否跳出并从定向:
if(window.top != window.self){
  top.location.href = location.href;
}
 

 


欢迎大家关顾我的Facebook主页「Y Life Book」以及我的公众微信号「不点语书」,我们下期见。

Leave a Comment

Your email address will not be published. Required fields are marked *