window.opener
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
概述
返回打开当前窗口的那个窗口的引用,例如:在 window A 中打开了 window B,B.opener 返回 A.
语法
var objRef = window.opener;
例子
js
if (window.opener != indexWin) {
referToTop(window.opener);
}
备注
如果当前窗口是由另一个窗口打开的,window.opener保留了那个窗口的引用。如果当前窗口不是由其他窗口打开的,则该属性返回 null.
规范
Specification |
---|
HTML # dom-opener-dev |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
opener |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
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.