window.opener & window.parent & window.top

when to use window opener/ window parent/ window top?


從這篇中擷取答案重點如下:

window.opener:

--> refers to the window that called window.open( ... ) to open the window from which it's called


window.parent:

--> refers to the parent of a window in a <frame> or <iframe>


window.top: 

--> refers to the top-most window from a window nested in one or more layers of <iframe> sub-windows



最後, 介紹一下window.parent,

window.parent:

--> A reference to the parent of the current window or subframe.

--> If a window does not have a parent, its parent property is a reference to itself.

--> When a window is loaded in an <iframe>, <object>, or <frame>, its parent is the window with the element embedding the window.


Window parent Property:




留言

熱門文章