Changes in Opera’s user agent string format

By Andreas Bovens

Our latest weekly snapshot identifies itself in a slightly unexpected fashion (as will the beta and final versions of Opera 10). The user agent for Opera 10 (eg Mac platform, English locale) will be as follows:

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

Confused? Let me explain this in more detail.

When we released the Opera 10 alpha in December last year, we gave it a Opera/10.00 (Macintosh; Intel Mac OS X; U; en) Presto/2.2.0 user agent string. This was a logical follow-on from previous browser versions, but we soon found out that the Opera/10.00 part was not digested well on a number of sites that deploy browser sniffing to serve version-specific content and scripts. As browsers haven’t been around for a very long time yet, their version numbers have stayed in the realm of single digits thus far; Opera reaching 10 is the first of its kind. It appears that a considerable amount of browser sniffing scripts are not quite ready for this change to double digits, as they detect only the first digit of the user agent string: in such a scenario, Opera 10 is interpreted as Opera 1. This results in sites mistakenly identifying Opera 10 as an unsupported browser, thereby breaking server, as well as client-side scripts.

Browser sniffing — unless you’re writing a web stats application — is always a bad idea. It’s a misguided attempt to send different content to different user agents. This is never scalable — you can’t change every website you’ve ever made every time a new browser version comes out. It is also not future-proof, as highlighted by this article.

It’s important to note that other browsers — including Internet Explorer, which is two versions away from the dreaded 10 number — might face similar problems in the future, unless site administrators fix their scripts.

For those interested in an example, try to load http://www.allocine.fr/video/merciqui/ with our earlier Opera 10 alpha build. You’ll see that after the advertising intro, the Flash video is shown at half the intended height. This is because the browser sniffing script on which the height parameter depends interprets Opera 10 as 1, which results in an incorrect value and a broken layout.

So, after a few months of careful analysis of the impact this Y2K-like versioning problem may have on site compatibility, we’ve decided to freeze the first part of the string as Opera/9.80 for now, and add the version number in the end — hence the Version/10.00 appendix. This construct allows us to somehow serve the real version number, while sidestepping the various double digit-related issues described above. In future releases, we plan to update the Version part. For example, Opera 11 will have a Version/11.00 appendix, and so on.

For those interested, here is a little note from behind the trenches: for a while, we considered going with Opera/9.99 as it is only 0.01 away from 10, but in the end we settled on Opera/9.80, as this gives us some room for manoeuvre in the future in case we somehow want to update the Opera version number, while still staying below 10. The web is a moving target, so better be prepared for the unexpected!

Feel free to leave any questions you may have in the comment section, and of course, we hope you’ll enjoy Opera 10!

Andreas is based in Oslo, where he works for Opera Software as extensions product manager and developer relations lead.


This article is licensed under a Creative Commons Attribution, Non Commercial - Share Alike 2.5 license.

Comments

The forum archive of this article is still available on My Opera.

No new comments accepted.