Skip to Content
Platform.Ontology

Device client hints (DPR, Viewport, Memory)

Opt-in headers carrying DPR, viewport width, device memory and color scheme.

Gets silentlyNetwork and connectionClient HintsWeb browsersWhen the page loadsWhile you use it

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

BrowserStatusFirst versionReleasedNote
ChromeSupported892021-03-02None
EdgeSupported902021-04-15None
FirefoxNot supportedNot availableNot listedNone
SafariNot supportedNot availableNot listedNone
Safari on iPhoneNot supportedNot availableNot listedNone
Chrome on AndroidSupported892021-03-02None
Samsung InternetSupported15.02021-08-13None

How a site asks for it

APIAccept-CH: Sec-CH-DPR, Sec-CH-Viewport-Width, Sec-CH-Device-Memory, Sec-CH-Prefers-Color-Scheme
How access is grantednone
What the user seesNone
Needs a secure context (HTTPS)No
Needs a user gestureNo
How long it lastsread fresh on every page load; nothing stored
How to take it backnone needed (no grant)
Inside an iframeReadable from cross-origin iframes too (same values)

Typical flow

  1. Page script reads the value
  2. No prompt is shown

Data you get

Shape: object
How often: static per session

FieldTypeUnitRangePrecision
Sec-CH-DPRfloatratioNot listedNot listed
Sec-CH-Viewport-WidthintegerCSS pxNot listedexact
Sec-CH-Device-MemoryfloatGB0.25 to 8Not 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

TypeExampleApps
shoppingA 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
gamesA 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
mediaA news site picks a dark or light page from the color scheme hint and avoids a bright flash on first paint.None named
videoA video site picks a starting quality from window width and screen sharpness before the player even loads.None named
adsAn ad server picks an ad size matching the window width, and may combine other hints to recognize a device again.None named
analyticsA tool records memory and screen hints to show what kind of devices visitors use, and to plan support.None named
developerA 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

ScoreValueMeaning
Sensitivity1 of 5How revealing the data is
Utility3 of 5How useful it is to honest apps
Friction0 of 5How much the user has to do
Fingerprint bits4Rough identifying entropy, when known

Sources

How well checked: Based on official documentation.

On this page