Device-Memory
Experimental
这是一个实验中的功能
此功能某些浏览器尚在开发中,请参考浏览器兼容性表格以得到在不同浏览器中适合使用的前缀。由于该功能对应的标准文档可能被重新修订,所以在未来版本的浏览器中该功能的语法和行为可能随之改变。
Device-Memory
是一个跟 Device Memory API 相关的请求头,它跟 Client Hints 请求头的作用相似,用来表示客户端设备内存的近似大小。
Header type | Request header |
---|---|
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 Accept-CH
and Accept-CH-Lifetime
response headers.
语法
设备的内存大小可能会被用作指纹变量,因此将这个取值设置的比较粗糙,以减少滥用它的可能性。 请求头采用以下值:0.25、0.5、1、2、4、8。
Device-Memory: <number>
示例
服务器需要先发送包含 Device-Memory
的 Accept-CH
和 Accept-CH-Lifetime
响应头,来表明可以接收 Device-Memory
请求头.
Accept-CH: Device-Memory Accept-CH-Lifetime: 86400
接下来客户端发送的请求则可能会包含 Device-Memory
请求头:
Device-Memory: 1
规范
规范 | 状态 | 注释 |
---|---|---|
Device Memory 1 Device-Memory |
Editor's Draft | Initial definition. |
浏览器兼容性
BCD tables only load in the browser
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.