When to use window.opener / window.parent / window.top

后端 未结 4 1299
野的像风
野的像风 2020-11-28 19:27

In JavaScript when to use window.opener / window.parent / window.top ?

4条回答
  •  情歌与酒
    2020-11-28 19:46

    top, parent, opener (as well as window, self, and iframe) are all window objects.

    1. window.opener -> returns the window that opens or launches the current popup window.
    2. window.top -> returns the topmost window, if you're using frames, this is the frameset window, if not using frames, this is the same as window or self.
    3. window.parent -> returns the parent frame of the current frame or iframe. The parent frame may be the frameset window or another frame if you have nested frames. If not using frames, parent is the same as the current window or self

提交回复
热议问题