【发布时间】:2011-06-03 10:18:37
【问题描述】:
如果父级本身也在 iframe 中,我如何从 iframe 中的页面判断?
解释:
我的主页home.html 包含一个 iframe
<iframe src="sample.html"></iframe>
我需要检测home.html(即:sample.html 的父级)是否在 iframe 内。
sample.html中的代码:
if(self==window)
{
alert('home.html is not in iframe');
}
else
{
alert('home.html is in iframe');
}
我的问题不是重复的。情况不同。
【问题讨论】:
-
有点不清楚... iframe 中的页面中是否有 iframe?是否要检查页面是否在 iframe 中,或者包含 iframe 的页面是否在 iframe 中?
-
那有什么不同呢? :s
-
一旦 home.html 是 iframe,那么我需要检测 home.html 是来自 sample.html 的 iframe。
-
没有一个答案有效
标签: javascript jquery iframe