Latest web development tutorials

Window parent attribute

Window Object Reference Window object

Definition and Usage

parent property returns the parent window of the current window.

grammar

window.parent


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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>

try it"


Window Object Reference Window object