The User-Agent HTTP header was introduced in 1993 by the first web browser. The string was as simple as Mosaic/0.9. It could be used for good purposes. Web server can serve slightly different content to browsers which might implement new standards differently. Sadly, Google is abusing its dominant position to blocking or malfunctioning its services for competitive browsers. Therefore, a new mechanism of declaring technical aspects of user’s device is emerging.
- Google has blocked YouTube for Windows Phone devices.
- Google Docs and Gmail has forced users of competitive browsers to “upgrade” to Chrome.
- Google search is serving annoying popup to all other browsers than Chrome for years.
- Google’s Stadia gaming service is blocked to Chromium-based Edge browser.
There are thousands of UA string parsing a decide algorithms worldwide and new browser should be ideally compatible with all of them. Of course, this is not even possible. Browser sniffing is very difficult and always was. The long-term plan is to freeze the UA string and consolidate it into something what will not reveal much information about user’s device.
Instead, there is a new standard on the horizon which reveals important characteristics of the user’s device.
Client Hints
Client Hints are a set of HTTP request headers which browser could send to the server. Web page must opt-in for these headers by sending this header in the response:
Accept-CH: Viewport-Width, Downlink
or by declaring a specialized meta tag:
<meta http-equiv="Accept-CH" content="Viewport-Width, Downlink">
The browser will include following headers in the upcoming requests:
Viewport-Width: 1080
Downlink: 2.5
This standard will possibly replace picture and srcset responsive images because it can handle more complex use cases.
Current list of device hints
- Device-Memory is the approximate amount of device’s volatile memory in GB.
- Downlink is approximate downstream bandwidth in Mbps.
- DPR is a short for device pixel ratio.
- Early-Data indicates that the request has been conveyed in TLS early data.
- ECT is a short for effective connection type. Possible values are 4g, 3g, 2g, and slow-2g.
- RTT is the approximate round-trip time in ms.
- Save-Data indicates the user agent's preference for reduced data usage.
- Viewport-Width is the width of the viewport in CSS pixels.
- Width is the width of the viewport in physical pixels.