js判断是否在iframe中

来源:互联网 发布:广联达投标软件 编辑:程序博客网 时间:2024/06/05 20:41
/方式一
if (self.frameElement && self.frameElement.tagName == "IFRAME") {
alert('在iframe中');
}
//方式二
if (window.frames.length != parent.frames.length) {
alert('在iframe中');
}
//方式三
if (self != top) { 
alert('在iframe中');
}


父窗口跳转
window.parent.location.href="baidu.com";
0 0
原创粉丝点击