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 servers can serve slightly different content to browsers that might implement new standards differently. Sadly, Google is abusing its dominant position by blocking or malfunctioning its services for competitive browsers. Therefore, a new mechanism for declaring the technical aspects of a user’s device is emerging.
- Google has blocked YouTube for Windows Phone devices.
- Google Docs and Gmail have forced users of competitive browsers to “upgrade” to Chrome.
- Google search has been serving an annoying popup to all browsers other than Chrome for years.
- Google’s Stadia gaming service is blocked on the Chromium-based Edge browser.
There are thousands of UA string parsing and decision algorithms worldwide, and new browsers should ideally be compatible with all of them. Of course, this is not even possible. Browser sniffing is very difficult and always has been. The long-term plan is to freeze the UA string and consolidate it into something that will not reveal much information about the user’s device.
Instead, there is a new standard on the horizon that reveals important characteristics of the user’s device.
Client Hints
Client Hints are a set of HTTP request headers that the browser can send to the server. The 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 the 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 the device’s volatile memory in GB.
- Downlink is the approximate downstream bandwidth in Mbps.
- DPR is short for device pixel ratio.
- Early-Data indicates that the request has been conveyed in TLS early data.
- ECT is 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.