Browser Detection Part Doh! (will I ever learn?)

Recently, I wrote about browser detection complaining about vendor/version detection strategies…

While converting my old “Your browser is out of date” messaging on this site from using a page redirect to an in-page message div, I realized that I had messed up my own browser detection for the latest released versions of Gecko-based browsers. doh!

It just goes to show that detecting vendor/version is problematic and should be avoided unless you have a very good reason.

If you are interested in the code, you can check it out. Let me know if you find any errors in this version.

Browser Detection Part Duh (will they ever learn?)

Recently, mozilla.org began changing the User Agent strings of the development versions of Firefox on the Gecko 1.8 branch and the 1.9 trunk to reflect their eventual release some time far in the future as Firefox 2 and Firefox 3. As has been the case for many years, these builds were not publicly promoted by mozilla.org and the version numbers had an a1 appended to the version number, e.g. 2.0a1 and 3.0a1, to signify that these builds were only for developers and members of the community who regularly use, develop and test on the development branch and trunk.

What has changed in the last few years is the increased popularity of Firefox has made it a target of those who attempt to generate ad-related income through unofficial announcements geared to drive traffic to their sites. These attention whores claimed prematurely that Firefox 2 and Firefox 3 had been released which resulted in their sites being prominately promoted on popular sites. I am sure they earned significant sums from their deceptive announcements but they also caused harm to the Mozilla community by misleading the general web population into thinking that the unstable development versions were ready for public use.

In order to prevent this from happening in the future, mozilla.org has changed the branding of the browser on the 1.8 branch to BonEcho and the browser on the trunk to Minefield. The User Agent strings now look like

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20060421 BonEcho/2.0a1

and

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20060421 Minefield/3.0a1

As a result, a number of web sites that use outmoded Vendor/Version browser detection strategies are now broken in BonEcho and Minefield. Examples of sites broken by this change can be found in bug 334967.

Strangely enough, this is a good thing!

Back when Netscape 6 and Mozilla M18 were new to the web, one of the biggest problems the Mozilla Evangelism project faced was broken web sites as a result of browser detection written for a world where there were only two browsers: (IE and Navigator).

In Browser Detection and Cross Browser Support I attempted to educate web developers about the hazards of Vendor/Version browser detection, but it appears I failed. All that seems to have changed, is that due to the increased popularity of Firefox, the web developers simply added additional Vendor/Version detection for Firefox. This has long been a source of problems for other unofficial Gecko browsers such as the excellent browser Camino for Mac OS X as well as Minimo, a browser for mobile devices. As you can see from a query for Tech Evangelism bugs referencing browser detection, these issues far outnumber the problems listed in bug 334967.

Hopefully, one side-effect of these changes will be the decrease in the use of Vendor/Version browser detection and the increased support for alternative browsers such as Camino and Minimo.

If you are a web developer who has forsaken the discredited Vendor/Version browser detection strategy, you are to be congratulated since these changes will not affect your sites.

If you are a web site owner who is not affected by these changes, you should appreciate your web developers for having created a future-proof design.

If you are a web developer who still uses Vendor/Version browser detection, then your sites may not work in the development versions of Firefox 2 or Firefox 3 or alternative browsers such as Camino or Minimo and you have only yourself to blame.

If you are the owner of a web site that has been broken by these changes, you should seriously review the processes, people and firms who create such fragile web sites that must be reworked every year or so to support new browsers.

/bc

Disclaimer

I work for Mozilla Corporation however the views expressed in this post are my own and are not those of anyone else but myself.