English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Window parent property

JavaScript Window Object

parentA read-only property that returns the parent window of the current window.

If the window does not have a parent window, its parent property is a reference to itself.

When a window is loaded into an <iframe>, <object>, or <frame>, its parent window is the window that contains the element embedding the window.

Syntax:

window.parent
parent.document.body.style.backgroundColor = "coral";
Test See‹/›

Browser Compatibility

All browsers fully support the parent property:

Property
parentYesYesYesYesYes

Technical Details

Return Value:The parent window object of the current window

More Examples

Display the position of the parent window when a new window is opened:

window.open("", "", "width=300, height=200");
document.getElementById("output").innerHTML = window.parent.location;
Test See‹/›

Related References

Window (Window) Reference:window.frameElement Property

Window (Window) Reference:window.self Property

Window (Window) Reference:window.top Property

Tag Reference:HTML <embed> Tag

Tag Reference:HTML <object> Tag

Tag Reference:HTML <iframe> Tag

JavaScript Window Object