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:

// 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 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