Why Opera 10’s User Agent Smells Bad

By Craig Buckler
We teamed up with SiteGround
To bring you the latest from the web and tried-and-true hosting, recommended for designers and developers. SitePoint Readers Get Up To 65% OFF Now

Opera 10The Opera browser has continued to evolve and version 10 will be released shortly.

All browsers identify themselves with a unique code known as a user agent. The alpha release in December 2008 used a logical user agent string, e.g. for a Mac in an English locale:

Opera/10.00 (Macintosh; Intel Mac OS X; U; en) Presto/2.2.0

However, all subsequent builds and the final release will use:

Opera/9.80 (Macintosh; Intel Mac OS X; U; en) Presto/2.2.15 Version/10.00

Version 9.8? What’s going on?

Opera is one of the oldest browsers and is the first to approach a double-digit version number. Unfortunately, the Opera developers started to experience strange problems with a selection of sites that use browser sniffing to serve version-specific content and/or scripts. Many of the sniffing scripts simply detected the first digit in the user agent string and boldly assumed they were running on Opera 1 rather than Opera 10. Worse still, many of these sites decided that the browser was unsupported and refused to provide any content.

The Opera team deliberated the site compatibility problem and came up with the best compromise: freeze the first part of the string at 9.80 but append the real version number to the end. v9.80 was chosen rather than v.9.99 just in case there is a need to update the initial version number at a future date.

The same problem is likely to hit Microsoft; Internet Explorer is not far behind at version 8.0, and would probably be there now if the company hadn’t abandoned the browser for 6 years. Mozilla, Apple, and Google may have a little way to go, but Opera’s problem illustrates another reason why browser sniffing is a bad idea … more reasons coming soon…

Would the original Opera 10 user agent string have affected any of your websites?

We teamed up with SiteGround
To bring you the latest from the web and tried-and-true hosting, recommended for designers and developers. SitePoint Readers Get Up To 65% OFF Now
  • The real issue is that you should never use browser sniffing that is going to refuse content to users. I think Opera found the only solution that doesn’t leave their users in the dust, even if having an incorrect user agent string.

  • I agree with charmedlover…this is really an issue of bad programming and the browser having to accommodate it. An interesting thing to think about is that this same issue is probably going to come up again when IE 10 comes out one day, and it could have a huge impact.

  • More than anything I think the fact Opera’s developers even took this into account shows how often these scripts are used. But are they really important?
    What are the majority of these scripts used for? Identifying the users browser for theme/design purposes? Just smacks of lazy coding to me.
    Sure I guess you could use it to advise your readers that they’re using an under-par web browser (we all know which browser I’m talking about here ;) and perhaps to try something else out. But is that important enough for opera to actually take their version number into account?

    Personally, I don’t think so.

  • @stressonthesky it does smack of lazy coding. BUT most people will just say “stupid Opera!” and not realize that it’s really the websites fault. Remember all the people who thought IE7 was “broken” because websites weren’t rendering correctly? People will blame the browser first not the website. Opera was smart to make this change, they already have a small sliver of the market, don’t want to lose just because some dumbass can’t code.

  • stk

    If browser sniffing is such a bad idea, why cater to it? Ultimately, it’s the website owner that wants “their message” (whatever it is) to get out and if it’s failing b/c of a poorly written browser-sniffing script, it WILL be re-written.

    Our sites are coded to follow web standards (XHTML/CSS) and with accessibility in mind. We don’t care about the user agent. (That said, it’d sure be nice to target every browser in the CSS, like IE with conditional comments, just to handle those one-off rendering issues).

    And … how many people use Opera v1?

  • @ChestRockwell A fair point, I do concede that the majority of any browsers’ users aren’t going to be tech savvy and are likely to get frustrated. However, the coders behind these browser sniffer scripts should know what they’re doing…

    I don’t know… the next thing will be some kind of compatibility mask/layer enforced by a browser; telling you that the page you’re looking at isn’t coded correctly (despite what the w3 say) and the browser has taken steps accordingly… oh wait there already is. Cheers IE8.

  • Kasimir

    Flash already has this problem with v.10 of the plug-in.

  • Joe544

    I wonder what would have happened if they changed the way the whole thing worked, instead of settling for 9.80 gone for something like:

    Opera/a10.00 (Macintosh; Intel Mac OS X; U; en) Presto/2.2.0

    or just spell Opera lower case? I mean, in reality, this is just a temporary fix, what happens with Opera 11? V 9.90….. then Opera 12??

    The problem is always going to be there, this is just a quick fix at the end of the day.

  • I like that Opera/a10 idea – very neat. Although I suspect several sites will still break because they’ll attempt to do mathematics on an ‘a’.

    For the moment, it appears Opera will simply append “Version/1X.00” to the end of the user agent. It might be a short-term fix, but I’ve a feeling it might be a long-term solution.

  • David Storey

    We couldn’t use any alpha characters in the UA string as that breaks sites too. One of the biggest reasons why we did this is because it effects ASP.net/IIS sites, meaning potentially many thousands of sites are broken by the Opera 10 UA string. These range from AJAX not working, large parts of the code being missing, or being out right blocked. Major sites like Bank of America were also effected.

  • Dave

    This sounds like the same kind of garbage that tries to force me to use Firefox to get the content of a site, claiming to be incompatible with my browser. In those cases, I show them I’m incompatible with their site and go find it somewhere else.

  • What I guess is, they have done this for a short time and this is a buzz for the developers who sniff their website for browsers. In the meanwhile, those developers will modify their code, so that their site will not break, when Opera revert to their original User Agent string.

  • Mark

    This is all they really could have done.

    PS. Many people seem to miss the fact the REAL version number is appended to the end..

    “Opera/9.80 (Macintosh; Intel Mac OS X; U; en) Presto/2.2.15 Version/10.00

    That will continue to increment, so properly maintained browser sniffing code can use that, broken detection code will get 9.8. Opera also mention this is only temporary and when IE reaches 10, and webmasters are forced to fix broken sites, Opera can remove it’s workaround.

  • I think a big problem is that when a coder builds a website, they use browser sniffing to make it look right.

    The poor client who relies on the website has no idea that browser sniffing is being used and do not realize they are loosing visitors.

  • NetHawk

    I’ve encountered problems with IE8. Some sites claim this is an outdated browser. If you look at the code, you see that the developer didn’t believe in any IE beyond 7 doing things like

    if not IE7 then show Message

    When will (amateur) browser sniffing come to an end (sigh)…

  • Pacoup

    This just makes it ok for people to use stupid browser sniffing techniques that don’t work, yet alone using browser sniffing to limit users at all.

  • @Pacoup
    That’s true, but who will users blame? The website (which works fine in IE) or the browser? As David Storey indicated, many IIS/ASP.NET sites and the Bank of America were affected. I don’t think they’d have worried if it were just a few dodgy blogs.

    We all know browser sniffing is dumb but, like it or not, many developers have resorted to doing it. Opera’s solution may be quick and dirty, but it won’t break major websites.