aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/document/referrer
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/document/referrer
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/document/referrer')
-rw-r--r--files/zh-cn/web/api/document/referrer/index.html38
1 files changed, 38 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/document/referrer/index.html b/files/zh-cn/web/api/document/referrer/index.html
new file mode 100644
index 0000000000..281b9dabdf
--- /dev/null
+++ b/files/zh-cn/web/api/document/referrer/index.html
@@ -0,0 +1,38 @@
+---
+title: document.referrer
+slug: Web/API/Document/referrer
+tags:
+ - API
+ - Document
+ - 参考
+ - 属性
+translation_of: Web/API/Document/referrer
+---
+<div>{{APIRef("DOM")}}</div>
+
+<p><strong><code>Document.referrer</code></strong> 返回的是一个 <a class="external" href="http://www.w3.org/Addressing/#background">URI</a>, 当前页面就是从这个 URI 所代表的页面 跳转或打开的.</p>
+
+
+
+<h2 id="语法">语法</h2>
+
+<pre class="syntaxbox notranslate">var <var>referrer</var> = <var>document</var>.referrer;
+</pre>
+
+<h3 id="值">值</h3>
+
+<p>如果用户直接打开了这个页面(不是通过页面跳转,而是通过地址栏或者书签等打开的),则该属性为空字符串。由于该属性只是返回一个字符串,所以不能够通过该属性引用页面的 DOM。</p>
+
+<p>在{{HTMLElement("iframe")}}中,<strong><code>Document.referrer</code></strong> 会初始化为父窗口{{domxref("Window/location", "Window.location")}}的{{domxref("HTMLHyperlinkElementUtils/href", "href")}}。</p>
+
+<h2 id="规范">规范</h2>
+
+<ul>
+ <li><a href="https://www.w3.org/TR/2009/REC-DOM-Level-2-HTML-20090303/html.html#ID-95229140">DOM Level 2: referrer</a></li>
+</ul>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<div class="hidden">下面这个兼容性表格由结构化数据生成,如果您想为该数据做贡献,请查看这里(<a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a>)并给我们发送PR。</div>
+
+<div>{{Compat("api.Document.referrer")}}</div>