aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/window/opener
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/window/opener
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/api/window/opener')
-rw-r--r--files/zh-cn/web/api/window/opener/index.html38
1 files changed, 38 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/window/opener/index.html b/files/zh-cn/web/api/window/opener/index.html
new file mode 100644
index 0000000000..52317273f7
--- /dev/null
+++ b/files/zh-cn/web/api/window/opener/index.html
@@ -0,0 +1,38 @@
+---
+title: window.opener
+slug: Web/API/Window/opener
+translation_of: Web/API/Window/opener
+---
+<p>{{ ApiRef() }}</p>
+
+<h3 id="Summary" name="Summary">概述</h3>
+
+<p>返回打开当前窗口的那个窗口的引用,例如:在window A中打开了window B,B.opener 返回 A.</p>
+
+<h3 id="Syntax" name="Syntax">语法</h3>
+
+<pre class="eval"><em>var objRef</em> = window.opener;
+</pre>
+
+<h3 id="Example" name="Example">例子</h3>
+
+<pre class="brush: js"> if (window.opener != indexWin) {
+ referToTop(window.opener);
+ }
+</pre>
+
+<h3 id="Notes" name="Notes">备注</h3>
+
+<p>如果当前窗口是由另一个窗口打开的, <strong>window.opener</strong>保留了那个窗口的引用. 如果当前窗口不是由其他窗口打开的, 则该属性返回 null.</p>
+
+<h3 id="Specification" name="Specification">规范</h3>
+
+<p>{{ DOM0() }}</p>
+
+<p>{{ languages( { "fr": "fr/DOM/window.opener", "ja": "ja/DOM/window.opener", "pl": "pl/DOM/window.opener", "en": "en/DOM/window.opener" } ) }}</p>
+
+<h3 id="浏览器兼容性">浏览器兼容性</h3>
+
+<p>{{Compat("api.Window.opener")}}</p>
+
+<p>注意:在Chrome78最近的几个版本,如果A、B页面跨域,A页面中打开B页面,在B页面使用console.log在控制台打印<strong>window.opener</strong>会报跨域的错误。</p>