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 modern 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
.
Specifications
Specification | Status | Comment |
---|---|---|
HTML Living Standard The definition of 'window.opener' in that specification. |
Living Standard |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
opener | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE No support No | Opera Full support 3 | Safari Full support 1 | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support 10.1 | Safari iOS Full support 1 | Samsung Internet Android Full support 1.0 |
Legend
- Full support
- Full support
- No support
- No support