DPR

Secure context
This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

这是一个实验中的功能
此功能某些浏览器尚在开发中,请参考浏览器兼容性表格以得到在不同浏览器中适合使用的前缀。由于该功能对应的标准文档可能被重新修订,所以在未来版本的浏览器中该功能的语法和行为可能随之改变。

DPR请求头是“ 客户端提示”消息头,它代表客户端设备的像素比(DPR),该比例是与每个CSS像素相对应的物理设备像素的数量。

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 DPR header from the client by sending Accept-CH and Accept-CH-Lifetime response headers.

语法

DPR: <number>

示例

Server first needs to opt in to receive DPR header by sending the response headers Accept-CH containing DPR and Accept-CH-Lifetime.

Accept-CH: DPR
Accept-CH-Lifetime: 86400

Then on subsequent requests the client might send DPR header back:

DPR: 1.0

浏览器兼容

BCD tables only load in the browser

参见