Skip to main content

Why Opera 10's User Agent Smells Bad

By Craig Buckler



Free JavaScript Book!

Write powerful, clean and maintainable JavaScript.

RRP $11.95

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?

Craig is a freelance UK web consultant who built his first page for IE2.0 in 1995. Since that time he's been advocating standards, accessibility, and best-practice HTML5 techniques. He's created enterprise specifications, websites and online applications for companies and organisations including the UK Parliament, the European Parliament, the Department of Energy & Climate Change, Microsoft, and more. He's written more than 1,000 articles for SitePoint and you can find him @craigbuckler.

New books out now!

Get practical advice to start your career in programming!

Master complex transitions, transformations and animations in CSS!

Latest Remote Jobs