--- title: Device-Memory slug: Web/HTTP/Headers/Device-Memory translation_of: Web/HTTP/Headers/Device-Memory ---
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. |
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
{{Compat("http.headers.Device-Memory")}}