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

Window parent property

Objet Window JavaScript

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

If the window has no 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";
Tester voir‹/›

Compatibilité navigateur

Tous les navigateurs supportent complètement la propriété parent :

Propriété
parentOuiOuiOuiOuiOui

Détails techniques

Retour valeur :Objet parent de la fenêtre actuelle

Plus d'exemples

Afficher la position de la fenêtre parent lors de l'ouverture d'une nouvelle fenêtre :

window.open("", "", "largeur=300, hauteur=200");
document.getElementById("output").innerHTML = window.parent.location;
Tester voir‹/›

Références associées

Référence Fenêtre (Window) :Propriété window.frameElement

Référence Fenêtre (Window) :Propriété window.self

Référence Fenêtre (Window) :Propriété window.top

Référence des balises :Balise <embed> HTML

Référence des balises :Balise <object> HTML

Référence des balises :Balise <iframe> HTML

Objet Window JavaScript