Why Opera 10’s User Agent Smells BadBy Craig Buckler
The 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?