如何知道窗口是子窗口还是父窗口?

时间:2022-09-07 07:25:07

How can a browser window know if it is a parent window or a child window using JavaScript?

如何使用JavaScript知道浏览器窗口是父窗口还是子窗口?

I was hoping to make use of this in a conditional.

我希望在有条件的情况下使用它。

if(parentWindow){//..

Thank you for any help.

感谢您的任何帮助。

1 个解决方案

#1


if( window !== top ) 
    //then you are a child of something

#1


if( window !== top ) 
    //then you are a child of something