子框架打开一个弹出窗口。如何检查是否从父级打开了弹出窗口?

时间:2012-05-18 17:31:23

标签: javascript html

我有一个页面包含一个框架。从这个框架内我可以打开一个弹出窗口。如何判断是否从父页面打开此弹出窗口?

1 个答案:

答案 0 :(得分:0)

if (window.opener && 
    window.opener.top === window.opener) {
    // this window was opened from a window that is it's own top (not an IFrame)
}