Window opener property
Definition and Usage
opener property is a read-write property, returns to the window to create the Window object references.
When using the window.open () to open a window, you can use this property to return the target window detailed information from the source (parent) window.
Code hints: window.opener.close () will be closed source (parent) window.
grammar
window.opener
Browser Support
All major browsers support opener property
Examples
Examples
Write text (the parent window) to the opener window:
<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ title>
<Script>
function openWin () {
myWindow = window.open ( '', '', 'width = 200, height = 100');
myWindow.document.write ( "<p> This is my window </ p>");
myWindow.focus ();
myWindow.opener.document.write ( "<p> This is the source window </ p>!");
}
</ Script>
</ Head>
<Body>
<Input type = "button" value = "open my window" onclick = "openWin ()" />
</ Body>
</ Html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ title>
<Script>
function openWin () {
myWindow = window.open ( '', '', 'width = 200, height = 100');
myWindow.document.write ( "<p> This is my window </ p>");
myWindow.focus ();
myWindow.opener.document.write ( "<p> This is the source window </ p>!");
}
</ Script>
</ Head>
<Body>
<Input type = "button" value = "open my window" onclick = "openWin ()" />
</ Body>
</ Html>
try it"
Window object