Window opener Property
Example
Write some text to the source (parent) window:
// Open a new window
var myWindow = window.open("", "myWindow",
"width=200, height=100");
// Write some text in the new window
myWindow.document.write("<p>This is 'myWindow'</p>");
// Write
some text in the window that created the new window
myWindow.opener.document.write("<p>This is the source window!</p>");
Try it Yourself »
Definition and Usage
The opener property returns a reference to the window that created the window.
When opening a window with the window.open() method, you can use this property from the destination window to return details of the source (parent) window.
Coding Tip: window.opener.close() will close the source (parent) window.
Browser Support
Property | |||||
---|---|---|---|---|---|
opener | Yes | Yes | Yes | Yes | Yes |
Syntax
window.opener
Technical Details
Return Value: | A reference to the window that created the window |
---|
Window Object