When I was working with User Agent strings today, I made the unfortunate discovery that Opera claims to be MSIE (according to their knowledge base site, this is the default -- or used to be, until version 8 according to this website and a friendly commenter here).
That is, of course, unpleasant, if a developer wants to display content to specific users based on their user agent. Unlike the current, ugly GeoIP epidemic (which I shall blog about another time), there are fairly good reasons for doing this -- all of which are negatively impacted by claiming to be a specific browser if you are not. Let me just name three of these reasons, off the top of my head:
- Relevance. Some content (pictures, instructions, warnings) may simply not apply to people outside a specific user group.
- Workarounds. Particularly MSIE 6 was/is infamous for numerous bugs and inconsistencies, some of which can be worked around. There is little reason why anyone else would like to see these "hacks" applied to the page they are visiting.
- Differences in technology. Some people produce browser extensions for, for example, both Firefox and MSIE. They may want to serve appropriate instructions to these users, and maybe a third page to everyone else.
I am not only convinced some Opera users would be outraged to be served Internet-Explorer-only content. I also assume that through Opera's claiming to be MSIE, Opera users can report numerous cases when the false user agent triggered some quirks on websites that were installed by the website author only to handle MSIE's abundant bugs at the time. Why anyone would want this setting to be the default, I cannot understand: Claiming to "be somebody else" should be the exception, not the rule.
People have blogged before about the near-uselessness of the User Agent string (in connection with Google Chrome's football-field-long UA string), and they have probably done a much better job than I would. From a developer perspective though, this is frustrating. So I twittered:
Uhm, why does Opera claim to be MSIE in its User Agent string?
To be fair, only old versions of Opera do that.
and soon thereafter, I got this interesting answer from a friend:
... they were hoping to be accidentally bundled with Windows.
I must say, in the light of Opera being the initiator of the ongoing antitrust investigation of the European Commission against Microsoft, this answer does not fail to convey a faint notion of irony.
Update: Commenter Eric points out that Opera's knowledge base article that I am citing on the top is outdated and the default user agent string used by Opera is much simpler. Well, excellent.
Update 2: Another commenter points out that Opera's impersonating MSIE has historic reasons dating back to the pre-Firefox era. -- Now that these reasons are not present anymore, the UA has been adapted.