Content-DPR header
Deprecated
Avoid using this feature in new projects. This feature may be a candidate for removal from web standards or browsers.>
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Non-standard: This feature is not standardized. We do not recommend using non-standard features in production, as they have limited browser support, and may change or be removed. However, they can be a suitable alternative in specific cases where no standard option exists.
The HTTP Content-DPR response header is used to confirm the image device to pixel ratio (DPR) in requests where the screen DPR client hint was used to select an image resource.
Note:
The Content-DPR header was removed from the client hints specification in draft-ietf-httpbis-client-hints-07.
The Responsive Image Client Hints specification proposes to replace this header by specifying intrinsic resolution/dimensions in EXIF metadata.
If the DPR client hint is used to select an image, the server must specify Content-DPR in the response.
If the value in Content-DPR is different from the DPR value in the request (i.e., image DPR is not the same as screen DPR), the client must use the Content-DPR for determining intrinsic image size and scaling the image.
If the Content-DPR header appears more than once in a message, the last occurrence is used.
| Header type | Response header, Client hint |
|---|---|
| Forbidden request header | No |
| CORS-safelisted response header | No |
Syntax
Content-DPR: <number>
Directives
<number>-
The image device pixel ratio, calculated according to the following formula: Content-DPR = Selected image resource size / (Width / DPR)
Examples
See the DPR header example.
Browser compatibility
See also
- Device and responsive image client hints
Accept-CH- HTTP Caching: Vary and
Vary - Improving user privacy and developer experience with User-Agent Client Hints on developer.chrome.com (2020)