Window opener Property
Example
Open a window and write some text in the opener window:
const myWindow = window.open("", "", "width=300,height=300");
myWindow.opener.document.getElementById("demo").innerHTML = "HELLO!";
Try it Yourself »
Definition and Usage
The opener
property returns a reference to the window that created the window.
If window xxx opens window yyy:
yyy.opener returns xxx.
yyy.opener.close() closes xxx.
See Also:
Syntax
window.opener
Return Value
Type | Description |
A window | The window that created the window. |
Browser Support
window.opener
is supported in all browsers:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes | Yes |