From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../web/http/headers/device-memory/index.html | 78 ++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 files/zh-cn/web/http/headers/device-memory/index.html (limited to 'files/zh-cn/web/http/headers/device-memory') 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 +--- +
{{HTTPSidebar}}{{securecontext_header}}{{SeeCompatTable}}
+ +

Device-Memory 是一个跟 Device Memory API 相关的请求头,它跟 Client Hints 请求头的作用相似,用来表示客户端设备内存的近似大小。

+ + + + + + + + + + + + +
Header type{{Glossary("Request header")}}
{{Glossary("Forbidden header name")}}?
+ +
+

Note: Client Hints are accessible only on secure origins (via TLS). Server has to opt in to receive Device-Memory header from the client by sending {{HTTPHeader("Accept-CH")}} and {{HTTPHeader("Accept-CH-Lifetime")}} response headers.

+
+ +

语法

+ +

设备的内存大小可能会被用作指纹变量,因此将这个取值设置的比较粗糙,以减少滥用它的可能性。 请求头采用以下值:0.25、0.5、1、2、4、8。

+ +
Device-Memory: <number>
+
+ +

示例

+ +

服务器需要先发送包含 Device-Memory 的 {{HTTPHeader("Accept-CH")}} 和 {{HTTPHeader("Accept-CH-Lifetime")}} 响应头,来表明可以接收 Device-Memory 请求头.

+ +
Accept-CH: Device-Memory
+Accept-CH-Lifetime: 86400
+
+ +

接下来客户端发送的请求则可能会包含 Device-Memory 请求头:

+ +
Device-Memory: 1
+
+ +

规范

+ + + + + + + + + + + + + + +
规范状态注释
{{SpecName("Device Memory","#sec-device-memory-client-hint-header","Device-Memory")}}{{Spec2('Device Memory')}}Initial definition.
+ +

浏览器兼容性

+ + + +

{{Compat("http.headers.Device-Memory")}}

+ +

参见

+ + -- cgit v1.2.3-54-g00ecf