Window parent property

Definition and usage

parent The property returns the parent window (of the current window).

parent The property is read-only.

Hint

parent The property is top The properties are different.

window.parent Returns the direct parent of the window.

window.top Returns the top-level window in the window hierarchy.

See also:

Top attribute

Instance

Example 1

Change the background color of the parent:

parent.document.body.style.backgroundColor = "lightblue";

Try it yourself

Example 2

Position of the parent window:

location = window.parent.location;

Try it yourself

Syntax

window.parent

Or:

parent

Return Value

Type Description
Object The parent window of the current window.

Browser Support

All Browsers Support window.parent:

Chrome IE Edge Firefox Safari Opera
Chrome IE Edge Firefox Safari Opera
Support Support Support Support Support Support