Window opener Property

Example

Open a window and write some text in the opener window:

const myWindow = window.open("", "", "width=300,height=300");
myWindow.opener.document.getElementById("demo").innerHTML = "HELLO!";
Try it Yourself »

Description

The opener property returns a reference to the window that created the window.

If window xxx opens window yyy:

yyy.opener returns xxx.

yyy.opener.close() closes xxx.

See Also:

The open Method

The parent Property


Syntax

window.opener

Return Value

Type Description
A windowThe window that created the window.

Browser Support

window.opener is supported in all browsers:

Chrome Edge Firefox Safari Opera IE
Yes Yes Yes Yes Yes Yes


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.