Device client hints (DPR, Viewport, Memory)
Opt-in headers carrying DPR, viewport width, device memory and color scheme.
In one line
Can learn your screen density, window width, memory and light or dark mode in Chromium browsers
Opt-in headers carrying DPR, viewport width, device memory and color scheme.
Sec-CH-DPR, Sec-CH-Viewport-Width, Sec-CH-Width, Sec-CH-Device-Memory and Sec-CH-Prefers-Color-Scheme let servers pick image sizes and themes before first paint, and also hand the same fingerprint bits to every server that asks.
What it can and can't do
What the user does: Nothing. The browser sends it only after the site asks for it
It can
- Ask your browser to send screen sharpness, window width and device memory with each request
- See if you prefer dark mode
- Pick the right image size and theme before the page shows
It cannot
- Get any of it unless the site asks first and the browser agrees
- Work in Firefox or Safari, which do not send these
- See your name or account
- Learn exact memory, since it is rounded
How it differs between platforms: Chrome, Edge and Samsung Internet send these. Firefox and Safari, including all iPhone browsers, do not.
Browser support
| Browser | Status | First version | Released | Note |
|---|---|---|---|---|
| Chrome | Supported | 89 | 2021-03-02 | None |
| Edge | Supported | 90 | 2021-04-15 | None |
| Firefox | Not supported | Not available | Not listed | None |
| Safari | Not supported | Not available | Not listed | None |
| Safari on iPhone | Not supported | Not available | Not listed | None |
| Chrome on Android | Supported | 89 | 2021-03-02 | None |
| Samsung Internet | Supported | 15.0 | 2021-08-13 | None |
How a site asks for it
| API | Accept-CH: Sec-CH-DPR, Sec-CH-Viewport-Width, Sec-CH-Device-Memory, Sec-CH-Prefers-Color-Scheme |
| How access is granted | none |
| What the user sees | None |
| Needs a secure context (HTTPS) | No |
| Needs a user gesture | No |
| How long it lasts | read fresh on every page load; nothing stored |
| How to take it back | none needed (no grant) |
| Inside an iframe | Readable from cross-origin iframes too (same values) |
Typical flow
- Page script reads the value
- No prompt is shown
Data you get
Shape: object
How often: static per session
| Field | Type | Unit | Range | Precision |
|---|---|---|---|---|
Sec-CH-DPR | float | ratio | Not listed | Not listed |
Sec-CH-Viewport-Width | integer | CSS px | Not listed | exact |
Sec-CH-Device-Memory | float | GB | 0.25 to 8 | Not listed |
Technical limits
- Chromium only
- Only after Accept-CH
The story
What it is
Browsers can send screen density, window size and memory with each page request when a site asks.
For you
You never see it. If a site asks, your browser tells the server how sharp your screen is and how wide your window is. The server can then send the right sized picture right away.
For makers
Makers use it to ship the right image size and a lighter page for weaker devices, with no extra round trip. It also tells them things about your device that add to a fingerprint, which is why a site must ask first.
Where you see it
| Type | Example | Apps |
|---|---|---|
| shopping | A store gets the screen sharpness and window width, then sends one right sized product photo, so a phone does not download a huge desktop image. | None named |
| games | A browser game portal reads device memory and sends a lighter build to low memory phones, so the game does not crash on load. | None named |
| media | A news site picks a dark or light page from the color scheme hint and avoids a bright flash on first paint. | None named |
| video | A video site picks a starting quality from window width and screen sharpness before the player even loads. | None named |
| ads | An ad server picks an ad size matching the window width, and may combine other hints to recognize a device again. | None named |
| analytics | A tool records memory and screen hints to show what kind of devices visitors use, and to plan support. | None named |
| developer | A developer tests a site on a low memory phone to see that the lighter version really arrives. | None named |
Risks
- Adds to a fingerprint
- Chromium only
What the platform says
- MDN Web Docs: Client Hints. Servers can opt in to receive details about the device, so they can send the best version of a page first time.
Good uses and abuse
Legitimate uses
- Server-side image selection
Known abuse
- Passive fingerprint across requests
Scores
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 1 of 5 | How revealing the data is |
| Utility | 3 of 5 | How useful it is to honest apps |
| Friction | 0 of 5 | How much the user has to do |
| Fingerprint bits | 4 | Rough identifying entropy, when known |
Related capabilities
Related
- Approximate device RAM. Can see roughly how much RAM you have, rounded and capped at 8 GB
- Device pixel ratio and zoom. Can see your screen's sharpness factor, which also shifts when you zoom
Sources
How well checked: Based on official documentation.