In 2022, Firefox and Chrome will reach a version number with three digits: 100
.
It's time to get ready and extensively test your code, so your code doesn't return null
or worse 10
instead of 100
.
Some contexts
The browser user agent string is used in many circumstances, on the server side with the User-Agent
HTTP header and on the client side with navigator.userAgent
. Browsers lie about it. Web apps and websites detection do not cover all cases. So browsers have to modify the user agent string on a site by site case.
Browsers Release Calendar
According to the Firefox release calendar, during the first quarter of 2022 (probably March), Firefox Nightly will reach version 100. It will set Firefox stable release version around May 2022 (if it doesn't change until then).
And Chrome release calendar sets a current date of March 29, 2022.
What Mozilla Webcompat Team is doing?
Dennis Schubert started to test JavaScript Libraries, but this tests only the libraries which are up to date. And we know it, the Web is a legacy machine full of history.
The webcompat team will probably automatically test the top 1000 websites. But this is very rudimentary. It will not cover everything. Sites always break in strange ways.
What Can You Do To Help?
Browse the Web with a 100
UA string
- Change the user agent string of your favorite browser. For example, if the string is
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:89.0) Gecko/20100101 Firefox/89.0
, change it to beMozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:100.0) Gecko/20100101 Firefox/100.0
- If you notice something that is breaking because of the UA string, file a report on webcompat. Do not forget to check that it is working with the normal UA string.
Automatic tests for your code
If your web app has a JavaScript Test suite, add a profile with a browser having 100
for its version number and check if it breaks. Test both Firefox and Chrome (mobile and desktop) because the libraries have different code paths depending on the user agent. Watch out for code like:
const ua_string = "Firefox/100.0";
ua_string.match(/Firefox\/(\d\d)/); // ["Firefox/10", "10"]
ua_string.match(/Firefox\/(\d{2})/); // ["Firefox/10", "10"]
ua_string.match(/Firefox\/(\d\d)\./); // null
Compare version numbers as integer not string
Compare integer, not string when you have decided to have a minimum version for supporting a browser, because
"80" < "99" // true
"80" < "100" // false
parseInt("80", 10) < parseInt("99", 10) // true
parseInt("80", 10) < parseInt("100", 10) // true
Comments
If you have more questions, things I may have missed, different take on them. Feel free to comment…. Be mindful.
Otsukare!