The User-Agent Reduction deprecation trial allowed sites to continue receiving the full User-Agent string after UA string reduction. The trial ended September 23, 2023.
To replace functionality that relied on the User Agent string, you can implement the User Agent client hints API.
The User-Agent Client Hints page provides some background.
The remainder of this blog post should be considered deprecated.
Starting from Chrome 101, the information available in the User-Agent (UA) string will be reduced using a phased approach. Sites that haven't had time to migrate away from using the reduced User-Agent string and move toward User-Agent Client Hints can take part in a deprecation trial to continue receiving the full User-Agent string.
The registration for the deprecation trial will begin with the Chrome 100 Beta. It will allow sites to receive the full User-Agent string ahead of the Chrome 101 release, where the minor version string will be reduced. If you would like to test the origin trial on Chrome 100 Beta before it launches to the stable channel, be sure to register and test before the release date for Chrome 100 (currently scheduled for March 31st, 2022).
Below is an overview of the deprecation trial and what to expect. If you have feedback to share or you encounter any issues throughout this trial let us know in the UA Reduction GitHub repository.
What does this mean for web developers?
By enrolling in the deprecation trial, sites will continue to receive the full UA string in navigator.userAgent
and non-reduced values in the related navigator.platform
and navigator.appVersion
JavaScript getters:
- The
User-Agent
HTTP request header - The
navigator.userAgent
Javascript getter - The
navigator.platform
Javascript getter - The
navigator.appVersion
Javascript getter
Sites should still audit their usage of the User-Agent header and related APIs, and if needed prepare to migrate to User-Agent Client Hints before the deprecation trial expires. The intent is to expire this deprecation trial once the User-Agent Reduction rollout is complete.
How do I participate in the User-Agent Reduction deprecation trial?
Register for the trial
To register for the origin trial and get a token for your domains, visit the User Agent Reduction deprecation trial page. If you are a third-party registering please check 'Third-party matching'.
Setup
Once you've registered for the trial, update your HTTP response headers with the following:
- Add
Origin-Trial: <ORIGIN TRIAL TOKEN>
to your HTTP response header. <ORIGIN TRIAL TOKEN
> contains the token you got when registering for the origin trial. - Add
Accept-CH: Sec-CH-UA-Full
to your HTTP response header. SettingAccept-CH
will only cause the full User-Agent string to be sent on subsequent requests to the origin. - If the full User-Agent string is critical on first request add
Critical-CH: Sec-CH-UA-Full
to your HTTP response header, in addition to theAccept-CH
andOrigin-Trial
headers. For participants joining the reduction deprecation trial we suggest allowing all third-party domains access to the full User-Agent string. Failure to extend third-party domains access to the full User-Agent string will block their full User-Agent string access regardless of their own reduction deprecation trial registration. You can allow full User-Agent string access to third-party domains by one of the following two options:
- Add a
Permissions-Policy
header with the third-party domains that should receive the full User-Agent string.- To allow all third-party domains, add
Permissions-Policy: ch-ua-full=*
. - To allow a named list of third-party domains, add
Permissions-Policy: ch-ua-full=(self "https://thirdparty.example.com")
.
- To allow all third-party domains, add
- Add an
Accept-CH
meta tag with the third-party domains that should receive the full User-Agent string (only in Chrome 100 and above).- To allow a named list of third-party domains, add
<meta http-equiv="delegate-ch" value="sec-ch-ua-full https://thirdparty.example.com">
. - It's not possible to delegate to all third-party domains via
*
in the meta tag.
- To allow a named list of third-party domains, add
- Add a
Load your website in Chrome 100 (or later) and continue receiving the full User-Agent string.
Demo
See https://uard-ot-demo.glitch.me for a demonstration of the trial (along with the source code).
How do I validate that the trial is working?
To validate that the origin trial is working, examine the request headers and ensure the following:
- The User-Agent header contains the full version. It shouldn't contain any of the reduced values (found in the list of samples of reduced User-Agent strings). An easy way to tell is that the Chrome minor version string should not be
0.0.0
. - The
Sec-CH-UA-Full
header is set to?1
.
The initial response's headers containing the origin-trial token should look like:
Subsequent request headers containing the full User-Agent string should look like:
How do I stop participating in the User-Agent Reduction deprecation trial?
At any given point in time during the trial, you can stop participating and receive the reduced User-Agent string. To stop participating:
- Send an
Accept-CH
header in your HTTP response that does not includeSec-CH-UA-Full
. Note thatAccept-CH
with an empty value is a valid way to accomplish this if your site does not request any other Client Hints. - Remove the
Origin-Trial
header for the User-Agent Reduction deprecation trial from your HTTP response. - If set, remove
Sec-CH-UA-Full
from theCritical-CH
header in your HTTP response.
How is this trial different from other User-Agent origin trials?
Chrome is running two origin trials related to User Agent reduction. The first was User Agent Reduction origin trial, which allowed sites to receive the reduced user agent string to test their use cases and provide feedback before it becomes the default behavior in Chrome.
The second, referenced here, is a deprecation trial intended for sites that need a little more time to migrate to the User-Agent Client Hints API. It enables sites to continue receiving the full User-Agent string.
How long will the deprecation trial last?
The User-Agent Reduction deprecation trial will run from Chrome 100 to Chrome 115. Chrome 116 will be the first release where only the completely reduced User-Agent string is sent.
How do I share feedback for the User-Agent Reduction depreciation trial?
Submit any issues or feedback to the User-Agent Reduction GitHub repository.