Window.opener

The Window interface's opener property returns a reference to the window that opened the window using open().

In other words, if window A opens window B, B.opener returns A.

Syntax

const openerWindow = window.opener

Value

A Window referring to the window that opened the current window (using window.open(), or by a link with target attribute set). If this window was not opened by being linked to or created by another, returns null.

In some browsers, a rel="noopener noreferrer" attribute on the originating <a> element will prevent the window.opener reference from being set, in which case this property will return null.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
openerChrome Full support YesEdge Full support 12Firefox Full support YesIE ? Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown