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

浏览器兼容

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
DPR
Experimental
Chrome Full support 46Edge ? Firefox ? IE ? Opera Full support 33Safari ? WebView Android Full support 46Chrome Android Full support 46Firefox Android ? Opera Android Full support 33Safari iOS ? Samsung Internet Android Full support 5.0

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.

参见