JavaScript Window parent Tutorial

In this section, we will learn what Window parent property is and how to use it in JavaScript.

JavaScript Window parent Property

The `parent` property always points to the current window’s immediate parent window. For the topmost browser window, the value of `parent` property is equal to the `top` property (and both are equal to `window`).

Note: this property is read-only.

Window parent Property Syntax:

window.parent

Example: using Window parent property in JavaScript

See the Pen using Window parent property in JavaScript by Omid Dehghan (@odchan1) on CodePen.

Output: The parent window of the iframe is the main window.

Leave a Reply