Chrome 100 - Does it break user agent checking?

Chrome turns 100 soon, actually a fair bit sooner than I had originally thought now that we are on a 4 week release cycle (estimates are 36 weeks away).

I remember stories of how MS skipped Windows 9 because they were worried about a huge number of Apps checking for Windows 95 and Windows 98 by checking for "Windows 9". Are web developers doing something similar tricks when checking the User Agent? i.e, if (userAgent.indexOf('Chrome 10') > -1) { /* blah */ }

My initial gut feeling is that this is not a problem. I remember working with a lot of developers around that time and the workarounds I saw for Chrome 10 were to fix issues and incompatibilities that were present in Chrome but they were rarely done as a UA test.

I've been wrong many times in my life, so I performed a naive analysis by trawling the HTTP Archive with the following query.

SELECT
  *
FROM
  `httparchive.response_bodies.2020_10_01_desktop` response
WHERE
  body LIKE '%Chrome 10%'
  AND url LIKE '%.js%'

As expected it finds a lot of results. I manually analysed roughly 5000 results and in nearly all cases they are comments about workarounds in jQuery (btw, damn, jQuery has huge usage, it's a great example of don't fix what ain't broken) and comments about the libraries having been tested in Chrome 10+.

The above query is overly broad, and it's easy for things to get missed, so I also created a more specific query to times when people look for 'Chrome' in the user agent string.

SELECT
  *
FROM
  `httparchive.response_bodies.2020_10_01_desktop` response
WHERE
  REGEXP_CONTAINS(body, r"userAgent\.indexOf\([\'|\"]Chrome ")
  AND url LIKE '%.js%'

This returns just 2 results over the entire corpus of response data in HTTP Archive, both of which are not looking for Chrome versions, but rather attempting to detect Chrome OS.

The two queries don't cover all cases where a developer might check the User Agent, so I can't say with 100% confidence that developers aren't building experiences that adapt based on a check for version 10 of Chrome. However, because I manually checked so many sites, I do feel more comfortable that developers are not doing this in the client.

I am however, not confident about what developers do on the server where a lot of user agent specialization frequently occurs (it's part of the reason for User Agent Client hints proposal).

I would like to be a lot more confident that the change to Chrome 100 doesn't have any unintended side effects. If you know of a tool that you use that might be affected by the User Agent moving to 100, get in touch.

About Me: Paul Kinlan

I lead the Chrome Developer Relations team at Google.

We want people to have the best experience possible on the web without having to install a native app or produce content in a walled garden.

Our team tries to make it easier for developers to build on the web by supporting every Chrome release, creating great content to support developers on web.dev, contributing to MDN, helping to improve browser compatibility, and some of the best developer tools like Lighthouse, Workbox, Squoosh to name just a few.