rebron.org: Everyday Life, Work, Ironman Training

home | photos | toolbox | about me

October 22, 2006

UA or User Agent strings and Mozilla vs Gecko vs Firefox

Tags: mozilla.org — 1:19 pm Comments (0)

Summary

  • If you need to do browser detection, detect for browser capability versus a specific browser so you’re not locking people out.
  • If you need to detect for Firefox, consider using the Mozilla rv: number to capture all Mozilla-based browsers.
  • If you’re going to list out “System Requirements”, or this “site/application was tested with” what I believe is preferred* is “Mozilla Firefox [version number]” e.g. Mozilla Firefox 1.0
    “and above” or “and higher”. Or it’s Mozilla Firefox 1.5 or Mozilla Firefox 2. Note that Mozilla is dropping the min version for Firefox 2 so it’s Firefox 2 and not Firefox 2.0 except in the user-agent string which is Firefox 2.0. Makes sense?


Here’s a really good article that all web developers should read (article needs to be updated though): http://developer.mozilla.org/en/docs/Browser_Detection_and_Cross_Browser_Support

The user agent string for Firefox 2 is:

  • In general: Mozilla/5.0 (platform; security; OS or CPU; Locale; Mozilla Platform rv:) Gecko/yearmonthdate Vendor or product name/version
  • Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0
  • Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox 2.0

The user agent string for Internet Explorer 7 is (per the IE blog):

  • IE 7 Windows XP SP2: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)
  • IE 7 Windows Server 2003: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2)
  • IE 7 Windows Vista: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)

The user agent string for Safari is:

  • Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/XX (KHTML, like Gecko) Safari/YY

What’s does the Mozilla part mean?

Mozilla version e.g. Mozilla/2.0 was the original convention for identifying the product. Microsoft borrowed the Mozilla/version part, added “compatible” and here’s more on that history. When we changed the user agent string to Mozilla 5.0 with Netscape 6, we broke a lot of web sites but we’re all ok now — that was 6 years ago. Mozilla/5.0 and Mozilla/4.0 are no longer meaningful though and we shouldn’t ever see that changed for legacy/site compatibility reasons.

When targeting the Firefox browser for your web site/application, it’s actually better not to and detect for standards and capability versus targeting a particular browser version as the article mentions. If you must detect for Firefox, you should detect by Mozilla platform rv: version or rv:1.8.1. This makes it so that you don’t block out Mozilla browsers like Seamonkey or Camino or other applications using that same engine.

What about Gecko?

Gecko isn’t very meaningful these days either, it was used to indicate the new or NGL next generation layout engine which was then branded Gecko. It’s also Netscape trademark, licensed by the Mozilla Foundation. The “Gecko” brand really should go away since “powered by Netscape Gecko” really doesn’t mean anything. It takes a lot of energy to build a brand and Gecko is not actively being marketed as a browser engine.

The platform is actually the “Mozilla platform” with “rv:1.8.1” indicating the version of the “Mozilla Platform”. So “rv:mozilla platform version” trumps Gecko/date stamp. It’s not clear to me whether the Gecko date stamp is meaningful for web developers. I suspect that the Gecko portion of the user agent string can go away completely.

What about Firefox?

Hmm…So “Firefox/version” isn’t very useful either. Browser sniffing for “Firefox/version” in the UA string shouldn’t be used unless you’re really targeting for Firefox or a specific Firefox browser version (which you really shouldn’t be doing in the first place).

* need to verify w/ Moz Corp, but I’m guessing I’m right.



No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

rebron.org: Rafael Ebron's Web site