A page can read the real screen through CSS, whatever screen.width says. The max-device-width media query answers yes or no for any width you give it, so a binary search over it lands on the exact panel width in about thirteen calls. On one of our profiles screen.width said 1728 while that search came back with 1512, the Mac's real panel. Fixing the media-query route moved IPHey from Unreliable 90/100 to Trustworthy 100/100 on the same profile.

Four lines that find the real screen

The script is short enough to paste into a console:

let lo = 1, hi = 8000
while (lo < hi) { const mid = (lo + hi) >> 1
  if (matchMedia(`(max-device-width: ${mid}px)`).matches) hi = mid; else lo = mid + 1 }
lo   // the host's screen, whatever screen.width claims

device-width is the width of the whole screen, not of the window. The media queries specification has deprecated it in favour of width, and browsers still evaluate it. It costs a page nothing to ask. There is no permission prompt and nothing in the network traffic, and the script is optional: a stylesheet with a few @media (max-device-width: …) rules can load a different background image per range, and the server learns the bracket from which image was fetched.

On a real browser this tells a site nothing new, because screen.width and device-width come from the same place. They are one number read two ways. The search only finds something when the two have been made to disagree.

Why our engine disagreed with itself

Mosaic changes fingerprint values inside Tesseract Chrome, our Chromium, not with injected script. An earlier change in the engine moved Screen::width() and its siblings to the profile's claimed screen. That covered screen.width, screen.height and the avail values, and it stopped there.

The CSS engine does not ask Screen. In Blink, MediaValues::CalculateDeviceWidth reads ScreenInfo directly, a different subsystem that the change never touched. So the profile in question reported this:

screen.width                            1728
matchMedia("(device-width: 1512px)")    true    <- the real screen

1728 by 1117 is a real MacBook Pro resolution. It was a reasonable thing to claim, and it still failed, because the two routes disagreed.

Every profile is drawn from one real computer, not from separate listsIn Mosaic: Machines that exist. GPU, screen, CPU and fonts from one real device. Free covers 3 profiles with no card, and Pro is $25 a month for any number of them.

How it works: Machines that exist

How we found it: one switch of eighteen

We did not find this by reading Blink. IPHey's BROWSER card was red on a profile, and we bisected it the slow way. One profile, changed in place so that nothing else could differ between rounds, with each of the engine's spoofing switches turned off in turn. Of eighteen switches, --disable-spoofing=screen was the only one that turned the card green.

That said "the screen", not why. The next rows did:

Screen the profile claimedIPHey verdict
1728x1117, the baselineUnreliable, 90/100
screen spoofing offTrustworthy, 100/100
the host's own 1512x982Trustworthy, 100/100
another real Mac, 1470x956Unreliable, 90/100

The last row is the useful one. A different real Mac resolution failed exactly as the baseline did. If the site were checking claims against a table of real devices, 1470x956 would have passed. It failed because it differed from what CSS reported, so the site was comparing two routes to one value, and any claim other than the true panel would lose.

We ruled out one other suspect on its own. screen.availTop was also spoofed, so we set it to the host's real value, 34, and nothing changed.

The fix: the media query reads the claimed screen

The engine now makes the device-width and device-height media features read the same claimed screen as screen.width and screen.height. device-aspect-ratio is computed from those two, so it follows with no extra code. The switch that turns screen spoofing off turns this off too, so the control in the table above still means what it says.

One Blink quirk we left alone multiplies the reported screen size into physical pixels on Android. On a platform where it fires, the claimed number should scale with it exactly as the real one would, so the engine passes its value through the same multiply.

Like every other value we change, this one is changed inside the engine, and why we change values inside the engine and not in JavaScript explains what a script wrapper would have added: something for the page to find.

Where the second route was hiding

This was one of five values in the engine that turned out to have a second route nobody had looked for. Four of them we found by reading Blink for another caller of the same value. The touch screen was one: maxTouchPoints had three more ways to be asked (the four touch routes). The screen was the only one a detector found first, because its second caller sat in the CSS engine rather than next to the accessor we had changed.

What changed in how we work is where we search. When a value is claimed, we grep for the value's source, here ScreenInfo, across the whole renderer, and stop treating the accessor's neighbours as the full list. A media query, a client hint and a deprecated API are each worth one search before a change is called finished.

Check your own browser

Run the four lines above, then compare:

({ screenWidth: screen.width, cssDeviceWidth: lo })

On an ordinary browser the two match. If they differ, something changed screen.width and left CSS reading the real screen, and any site that runs the same search sees both numbers. In a Mosaic profile, both come from the profile's one claimed screen, drawn with the rest of its hardware (how a profile's machine is drawn). The values a page can read, and why a pair that disagrees outweighs either one alone, are in browser fingerprint.