aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/http/headers/dpr
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/http/headers/dpr
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/http/headers/dpr')
-rw-r--r--files/zh-cn/web/http/headers/dpr/index.html57
1 files changed, 57 insertions, 0 deletions
diff --git a/files/zh-cn/web/http/headers/dpr/index.html b/files/zh-cn/web/http/headers/dpr/index.html
new file mode 100644
index 0000000000..f725023128
--- /dev/null
+++ b/files/zh-cn/web/http/headers/dpr/index.html
@@ -0,0 +1,57 @@
+---
+title: DPR
+slug: Web/HTTP/Headers/DPR
+translation_of: Web/HTTP/Headers/DPR
+---
+<div>{{HTTPSidebar}}{{securecontext_header}}{{SeeCompatTable}}</div>
+
+<p><code><strong>DPR</strong></code>请求头是<font><font>“ </font></font><font><font><a href="https://wiki.developer.mozilla.org/en-US/docs/Glossary/Client_hints">客户端提示”</a>消息头,它代表客户端设备的像素比</font></font>({{Glossary("DPR")}})<font><font>,该比例是与每个CSS像素相对应的物理设备像素的数量。</font></font></p>
+
+<table class="properties">
+ <tbody>
+ <tr>
+ <th scope="row">Header type</th>
+ <td>{{Glossary("Request header")}}</td>
+ </tr>
+ <tr>
+ <th scope="row">{{Glossary("Forbidden header name")}}</th>
+ <td>?</td>
+ </tr>
+ </tbody>
+</table>
+
+<div class="blockIndicator note">
+<p><strong>Note:</strong> Client Hints are accessible only on secure origins (via TLS). Server has to opt in to receive <code>DPR</code> header from the client by sending {{HTTPHeader("Accept-CH")}} and {{HTTPHeader("Accept-CH-Lifetime")}} response headers.</p>
+</div>
+
+<h2 id="语法">语法</h2>
+
+<pre class="syntaxbox">DPR: &lt;number&gt;
+</pre>
+
+<h2 id="示例">示例</h2>
+
+<p>Server first needs to opt in to receive <code>DPR</code> header by sending the response headers {{HTTPHeader("Accept-CH")}} containing <code>DPR</code> and {{HTTPHeader("Accept-CH-Lifetime")}}.</p>
+
+<pre>Accept-CH: DPR
+Accept-CH-Lifetime: 86400
+</pre>
+
+<p>Then on subsequent requests the client might send <code>DPR</code> header back:</p>
+
+<pre>DPR: 1.0
+</pre>
+
+<h2 id="浏览器兼容">浏览器兼容</h2>
+
+<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
+
+<p>{{Compat("http.headers.DPR")}}</p>
+
+<h2 id="参见">参见</h2>
+
+<ul>
+ <li>{{HTTPHeader("Accept-CH")}}</li>
+ <li>{{HTTPHeader("Accept-CH-Lifetime")}}</li>
+ <li>{{HTTPHeader("Vary")}}</li>
+</ul>