X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR BOOTSTRAP XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

Window opener Property

Window Object Reference Window Object

Example

Write some text to the source (parent) window:

var myWindow = window.open("", "myWindow", "width=200, height=100");    // Opens a new window
myWindow.document.write("<p>This is 'myWindow'</p>");                  // Text in the new window
myWindow.opener.document.write("<p>This is the source window!</p>");  // Text in the window that created the new window

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

Internet Explorer Firefox Opera Google Chrome Safari

The opener property is supported in all major browsers.


Syntax

window.opener

Technical Details

Return Value: A reference to the window that created the window


Window Object Reference Window Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook