CSS feature and media query probing
Tests which CSS properties, at-rules and media queries the browser understands.
In one line
Can find your browser version by testing which style features it knows
Tests which CSS properties, at-rules and media queries the browser understands.
Each CSS feature has a first-supported version, so a handful of CSS.supports calls pin the browser version within 1 to 2 releases and expose spoofed user agents. Media queries add color gamut, HDR, contrast and motion settings.
What it can and can't do
What the user does: Nothing. It happens when the page loads
It can
- Test which CSS features and media queries your browser supports
- Narrow your browser version to within about 1 to 2 releases
- Spot a fake browser label, such as a spoofed user agent
It cannot
- Know who you are by itself
- Ask permission first
- See anything you typed or saved
- Tell your exact device model
Browser support
| Browser | Status | First version | Released | Note |
|---|---|---|---|---|
| Chrome | Supported | 28 | 2013-07-09 | None |
| Edge | Supported | 12 | 2015-07-29 | None |
| Firefox | Supported | 22 | 2013-06-25 | None |
| Safari | Supported | 9 | 2015-09-30 | None |
| Safari on iPhone | Supported | 9 | 2015-09-16 | None |
| Chrome on Android | Supported | 28 | 2013-07-10 | None |
| Samsung Internet | Supported | 1.5 | 2013-09-25 | None |
How a site asks for it
| API | CSS.supports(); @supports; matchMedia(); getComputedStyle() |
| Browser compat keys | api.CSS.supports_staticapi.Window.matchMedia |
| How access is granted | none |
| What the user sees | Not listed |
| Needs a secure context (HTTPS) | No |
| Needs a user gesture | No |
| How long it lasts | Not listed |
| How to take it back | Not listed |
| Inside an iframe | Not listed |
Typical flow
- Run CSS.supports for 50 to 300 property:value pairs
- Query matchMedia for color-gamut, dynamic-range, prefers-contrast, forced-colors, pointer, hover
- Compare against per-version tables
Data you get
What comes back: Bit vector of 100 to 300 feature results plus about 15 media query values
Shape: list
| Field | Type | Unit | Range | Precision |
|---|---|---|---|---|
supports bits | list | None | 0 or 1 each | exact |
color-gamut | enum | None | srgb, p3, rec2020 | exact |
prefers-reduced-motion | enum | None | no-preference, reduce | exact |
forced-colors | enum | None | none, active | exact |
Technical limits
- Cannot read the stylesheet of other origins
- Entropy mostly browser version and accessibility settings
The story
What it is
A script checks which CSS features and screen settings your browser understands to guess its make and version.
For you
You never see it. It looks like normal page loading. The page asks your browser many yes or no questions about style features, and the pattern of answers shows what browser and version you have.
For makers
Sites use it to ship modern designs with a safe fallback. Trackers use the same answers to pin your exact browser version and spot fake ones, such as a bot pretending to be Chrome.
Where you see it
| Type | Example | Apps |
|---|---|---|
| developer | A website checks whether your browser supports grid layout, then uses it or falls back to a simpler layout. | None named |
| security | A bot detector notices a browser claiming to be Chrome 120 that fails a test only new Chrome passes. | Cloudflare Turnstile, DataDome |
| analytics | A fingerprint library records dozens of CSS answers as one part of a visitor ID. | FingerprintJS |
| media | A streaming site checks for modern color and HDR display settings to offer the best video. | Netflix |
| accessibility | A page checks whether you prefer dark mode, reduced motion or high contrast and adjusts itself. | None named |
| games | A browser game checks for features like high frame rate or wide color before switching on fancy visuals. | None named |
| ads | An ad tech script uses screen and color settings to separate an iPhone from a lookalike emulator. | None named |
Risks
- Hard to hide
- Lets sites spot fake browsers
What the platform says
- MDN: CSS @supports. Lets a page test whether the browser supports a CSS feature, and apply styles only if it does.
Good uses and abuse
Legitimate uses
- Progressive enhancement
Known abuse
- Version pinning, UA spoof detection, accessibility setting disclosure
Scores
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 3 of 5 | How revealing the data is |
| Utility | 1 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 |
History
- 2018-05, paper: FP-Stalker and CreepJS use CSS feature sets to track version evolution
Related capabilities
Related
- JS and Web API feature detection (version pinning). Can test which web features exist to guess your exact browser version
Sources
How well checked: Based on official documentation.