Window parent attribute
Definition and Usage
parent property returns the parent window of the current window.
grammar
window.parent
Browser Support
All major browsers support parent attributes
Examples
Examples
When you open a new window, the parent window pop-up warning:
<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ title>
</ Head>
<Head>
<Script>
function openWin () {
window.open ( '', '', 'width = 200, height = 100');
alert (window.parent.location);
}
</ Script>
</ Head>
<Body>
<Input type = "button" value = "open window" onclick = "openWin ()">
</ Body>
</ Html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ title>
</ Head>
<Head>
<Script>
function openWin () {
window.open ( '', '', 'width = 200, height = 100');
alert (window.parent.location);
}
</ Script>
</ Head>
<Body>
<Input type = "button" value = "open window" onclick = "openWin ()">
</ Body>
</ Html>
try it"
Window object