直接上代码:
if(self.frameElement && self.frameElement.tagName=="IFRAME"){
//页面存在iframe中
}else{
//页面不存在iframe中
}
检测页面是否嵌套在iframe
本文提供了一段JavaScript代码,用于判断当前页面是否被嵌套在iframe元素中。通过检查DOM元素,此方法能够帮助开发者了解其网页的加载环境。
直接上代码:
if(self.frameElement && self.frameElement.tagName=="IFRAME"){
//页面存在iframe中
}else{
//页面不存在iframe中
}
1111
1867

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