Three-Digit Browser Versions in March 2022

Conventional wisdom says no one should be branching on browser User-Agent Strings. In practice, though, collectively, we do. And that habit is about to meet a version integer with three digits instead of two.

Karl Dubost flagged the shift. Mozilla's Firefox release calendar puts Firefox Nightly at version 100 during the first quarter of 2022 (probably March), with stable following around May 2022 if nothing shifts before then. The Chrome release calendar currently points at March 29, 2022.

Which means UAs in a shape like:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:100.0) Gecko/20100101 Firefox/100.0
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 KHTML, like Gecko) Chrome/100.0.0.0 Safari/537.36

Regexes with sloppy assumptions will bite their authors, but as Karl points out, even plain string comparison will:

"80" < "99" // true
"80" < "100" // false
parseInt("80", 10) < parseInt("99", 10) // true
parseInt("80", 10) < parseInt("100", 10) // true

Worth a pass over the codebase for navigator.userAgent to see what it's being asked to do.

CSS-Tricks star logo

Sponsor CSS-Tricks!

We've got lots of ways to help you connect with the greatest front-end community in all the land.

CSS-Tricks Newsletter

Sign up to get front-end roundups, browser updates, and exclusive content sent to your inbox bi-weekly.

Ads are self-hosted