Navigation

User Agents, They Are A’Changin’

Tuesday, October 30th, 2007

A while ago Adium had some troubles with our update mechanism that caused us to send versions of Adium to 10.3 users that would not launch on their operating system (since it was built against 10.4). One of the ways we mitigated this problem was to detect what version of OS X the users were running when they visited our website, and make the biggest, most obvious download link the correct one for their operating system.

Pretty cool, but there’s just one problem: there’s no way to detect that if the user isn’t using WebKit. Zac West used this table of WebKit version numbers to determine what OS a given user was running, based on which version of Safari shipped with that release.

That works well for browsers that come bundled with your system, but what about a third party browser? Gee, it’d be cool if there was a way to find out information about the browser being used to view your website.

Fortunately, the browser’s [User Agent string] (often just called its “UA”) is exactly the place for this sort of information to go, and indeed, that’s where those WebKit version numbers come from. Unfortunately, Firefox’s UA does not currently include which version of Mac OS X the was running on, despite Firefox’s Windows UA offering the ability to detect major releases of Windows.1

So eventually, after ranting about this several times on IRC, Dave Townsend mentioned that he’d be willing to write the patch if I shut up and filed the bug ;) So I did. He checked in his patch this morning, and it should be available in tomorrow’s nightly. On Intel Macs, our UA now looks something like:

Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9a9pre) Gecko/2007102604 Minefield/3.0a9pre

On a PowerPC machine running an equivalent build, we’d a little bit more crufty.2

Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O 10.4; en-US; rv:1.9a9pre) Gecko/2007102604 Minefield/3.0a9pre

Including this information in our UA is something I’ve heard requested a number of times, and I’m glad it’s finally in.


  1. Other *nixes also offer OS version information, but at least for Linux, Firefox uses the full kernel version, patch string included. Aside from the privacy implications, the kernel version is not really relevant. Perhaps which desktop environment you’re using (and its version) would be more appropriate, especially as we strive for more integration with GNOME. Update: Turns out hasn’t been the case for many years. That’s what I get for reading old bugs. Sorry! 

  2. There’s a bug open about removing that Mach-O token (it dates back to the earliest days of Mac OS X when Netscape was shipping both old-style CFM and new-style Mach-O binaries), but the user agent is a fragile beast, and removing tokens from it could break websites.