Mozilla Alerts Developers: Upcoming User-Agent Changes in Browsers
Written on
Chapter 1: Overview of User-Agent Strings
Mozilla has raised concerns for web developers regarding the upcoming versions 100 of Firefox and Chrome, which may lead to complications when handling user-agent strings that include three-digit version numbers. A user-agent string is a sequence of characters that a web browser sends, detailing information about the software, such as its name, version, and the technologies in use.
When users access a website, the browser transmits its user-agent string along with the request. This information allows the webpage to identify the visitor's browser version and adjust its response according to the features supported by that browser.
For instance, the user-agent for Firefox version 97 appears as follows:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:97.0) Gecko/20100101 Firefox/97.0
Similarly, the current user-agent for Google Chrome version 98 is:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.82 Safari/537.36
Section 1.1: Testing and Findings
In August 2021, Mozilla conducted tests to evaluate whether the 'Firefox/100' user-agent string would lead to website issues. Google promptly initiated its own tests for Chrome 100. Both Mozilla and Google found that websites could malfunction when processing a user-agent string with a three-digit version number.
Since then, Mozilla has been monitoring website failures triggered by the version 100 update, identifying issues on platforms such as HBO Go, Bethesda, Yahoo, Slack, and Duda website builder. These problems often ranged from sites claiming browser incompatibility to user interface bugs affecting specific sections.
Subsection 1.1.1: Understanding User-Agent Variations
Section 1.2: Implications for Web Developers
Mozilla explained in a recent blog post, "Different browsers employ various formats for their user-agent strings, and site-specific user-agent processing lacks a standard specification. Some parsing libraries may have rigid assumptions or bugs that overlook three-digit major version numbers." The organization noted that when browsers transitioned to two-digit version numbers, many libraries updated their parsing logic, so the three-digit version is anticipated to create fewer issues.
Chapter 2: Solutions and Recommendations
As both browsers prepare for their releases on March 29 for Chrome and May 3 for Firefox, Mozilla and Google will continue to conduct experiments regarding user-agent version 100. Should any website issues arise that cannot be resolved prior to these updates, both companies have contingency measures in place to minimize impact.
Mozilla provides a site interventions feature for Firefox, enabling users to freeze the user-agent at Firefox/99 or implement CSS or other overrides. Similarly, Chrome plans to set its user-agent string to version 99 for problematic sites while displaying the actual version in a different section of the user-agent string.
Mozilla encourages web developers and administrators to test their sites for compatibility with the Firefox 100 and Chrome 100 user-agents. This can be done by following these steps:
- In Firefox Nightly, set the major version number to 100.
- Access the Settings menu in Firefox Nightly.
- Search for "Firefox 100" and check the "Firefox 100 User-Agent String" option.
When enabled, the user-agent string for Firefox will change to:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0
To set Chrome to reflect the major version number as 100, navigate to chrome:/flags/#force-major-version-to-100 for further instructions and select 'Enabled' from the drop-down menu.
When enabled, Chrome's user-agent string will be:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4758.102 Safari/537.36
If any issues are found, Mozilla advises developers to file a report on webcompat.com to ensure timely resolutions.