Myopia and the Opera 10 User Agent String Friday, 29 May 2009
Opera has conceived a silly tactic planned for Opera 10 user-agent string.
The problem is that there are scripts that expect the browser major version to single-digit and will fail if it is not.
Since "10" not a single digit, these scripts fail.
Opera has mitigated that problem by changing the user-agent to 9.80 and publishing the following warning:
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.
Ineffectual and meaningless little blurb there. Those badly written sites that used (poor) browser detection will not break from Opera. Opera spoofing their own user-agent string helps reaffirm the misconception that the authors' browser detection worked. Posting up a little warning that not everyone will read does not make an example.
The blurb states that Browser detection is used "to send different content to different user agents". Not always true. In fact, browser detection is more often used on the client to work around an perceived incompatibility. Since Opera is wrong on that count, it makes the blurb seem even less relevant, as an author who read it might still try to justify or rationalize his approach by saying "but that's not why I used browser detection."
Browser detection scripts cause forwards-compatibility and maintenance problems. However, to not be able to parse out a number is not only not smart, it shows very poor coding skill.
Opera states that version 11 will have "11" in the user-agent string.
My opinion is somewhat in line with Doug's on this one (that Yahoo 360 URL is an awful URL).
If you are a developer, check your code. It really isn't hard to do this stuff correctly. It really isn't.
Where I disagree with Doug is "Opera has been forced to lie."
Opera developers made a decision to lie, as explained by Opera. They were not forced.
An alternative to that choice is for Opera to not cater to badly authored pages and simply let them break.
Breaking sites is bad in the short term because it renders pages unusable. However, it is good in the larger scheme of the web in the long run. By driving home a hard lesson, Opera could teach developers to not use browser detection by providing an historical lesson.
The first sensible opinion on the matter was Hallvord's post from December, 2008.,
where he pointed out that Bank of America and Live.com failed in Opera
10. The entry describes the reason: Faulty parsing of the User-Agent
string, and redirecting to the "not supported page".
You'd think that with the intense development Microsoft has been lavishing on live.com they would have found somebody capable of writing a usable browser sniffer (or ideally a person clever enough to say "wait, we don't really need one - what if we just use feature detection instead?"). Think again..
Of course, Microsoft has been advocating detection "best practices" for years, despite well reasoned arguments to stop doing that (G. Talbot, T. Zijdel).
Opera should be less myopic and stop worrying about breaking badly authored sites. Web developers should be less myopic, and build maintainable, forwards-compatible solutions.