aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/http/headers/device-memory
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/device-memory
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/device-memory')
-rw-r--r--files/zh-cn/web/http/headers/device-memory/index.html78
1 files changed, 78 insertions, 0 deletions
diff --git a/files/zh-cn/web/http/headers/device-memory/index.html b/files/zh-cn/web/http/headers/device-memory/index.html
new file mode 100644
index 0000000000..dbc49f5b0a
--- /dev/null
+++ b/files/zh-cn/web/http/headers/device-memory/index.html
@@ -0,0 +1,78 @@
+---
+title: Device-Memory
+slug: Web/HTTP/Headers/Device-Memory
+translation_of: Web/HTTP/Headers/Device-Memory
+---
+<div>{{HTTPSidebar}}{{securecontext_header}}{{SeeCompatTable}}</div>
+
+<p><code><strong>Device-Memory</strong></code> 是一个跟 <a href="/en-US/docs/Web/API/Device_Memory_API">Device Memory API</a> 相关的请求头,它跟 <a href="/en-US/docs/Glossary/Client_hints">Client Hints</a> 请求头的作用相似,用来表示客户端设备内存的近似大小。</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>Device-Memory</code> header from the client by sending {{HTTPHeader("Accept-CH")}} and {{HTTPHeader("Accept-CH-Lifetime")}} response headers.</p>
+</div>
+
+<h2 id="语法">语法</h2>
+
+<p>设备的内存大小可能会被用作指纹变量,因此将这个取值设置的比较粗糙,以减少滥用它的可能性。 请求头采用以下值:0.25、0.5、1、2、4、8。</p>
+
+<pre class="syntaxbox">Device-Memory: &lt;number&gt;
+</pre>
+
+<h2 id="示例">示例</h2>
+
+<p>服务器需要先发送包含 <code>Device-Memory</code> 的 {{HTTPHeader("Accept-CH")}} 和 {{HTTPHeader("Accept-CH-Lifetime")}} 响应头,来表明可以接收 <code>Device-Memory</code> 请求头.</p>
+
+<pre>Accept-CH: Device-Memory
+Accept-CH-Lifetime: 86400
+</pre>
+
+<p>接下来客户端发送的请求则可能会包含 <code>Device-Memory</code> 请求头:</p>
+
+<pre>Device-Memory: 1
+</pre>
+
+<h2 id="规范">规范</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">规范</th>
+ <th scope="col">状态</th>
+ <th scope="col">注释</th>
+ </tr>
+ <tr>
+ <td>{{SpecName("Device Memory","#sec-device-memory-client-hint-header","Device-Memory")}}</td>
+ <td>{{Spec2('Device Memory')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ </tbody>
+</table>
+
+<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.Device-Memory")}}</p>
+
+<h2 id="参见">参见</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/API/Device_Memory_API">Device Memory API</a></li>
+ <li>{{HTTPHeader("Accept-CH")}}</li>
+ <li>{{HTTPHeader("Accept-CH-Lifetime")}}</li>
+ <li>{{HTTPHeader("Vary")}}</li>
+ <li>{{DOMxRef("Navigator.deviceMemory")}}</li>
+</ul>