Opera's stubbornness and terrible JavaScript support?
Friday, 11. March 2005, 12:02:42
A fairly common criticism of Opera is that its JavaScript support is severely lacking, and that Opera Software refuses to address this because Opera only renders standards compliant code, and Opera Software is not going to do anything about it. Period. Indeed, Opera Software is seen by some people as a company completely out of touch with the real world. They base these comments, not on facts or actual official statements from Opera Software, but on comments they've heard from others saying the same thing. They, again, have heard it from others who heard it from someone else, and so on.
Both of these claims are, of course, completely false.
Opera and The Real Web
Not only does Opera render badly coded pages (including non-standard JavaScript), something which is necessary to work on the Web as it exists today. It even has a rendering mode specifically to deal with non-standard code. Yes, Opera Software actively promotes open standards, but at the same time, everyone must realize that a browser which doesn't handle bad code won't work on most sites. In an ideal world, all browsers would stick to standards, but unfortunately, the Web was not made that way.
Now, then, having established the fact that Opera does indeed handle bad and non-standard code, as much any browser used for today's Web pages, why do some pages still fail in Opera?
Who's to blame?
First of all, Opera, like all software, is not perfect. It can make mistakes! If a site doesn't work, it could be because of a bug in Opera, so please report problems so that they can be looked into!
However, in my experience the single biggest cause of non-working sites in Opera today is browser sniffing. What this means is that if a site isn't working, it is likely because it detects Opera, and then sends it code which differs from what the other browsers are getting. If only Opera had gotten the same as everyone else, it would have worked! This means that it is not Opera which fails because it has limited capabilities, or because Opera Software is stubborn. It is the site which actively looks for Opera, and then sends it broken code, or simply leaves out important parts.
Why they do this, I do not know. Some sites just give you a "browser not supported" page, while others fail silently, not telling you anything. They do their trickery in the background, giving the impression that it is Opera which is lacking, when it is in fact the people who coded the page who fouled up. (If you want a more technical explanation, have a look at Andrew Gregory's page about browser sniffing.)
Example
To illustrate my point, let's have a look at MSNBC's Web pages. If you visit the site with other browsers, you will be able to hover the menus to the left to get sub-menus. Try the same page in Opera, and what happens? The menu seems to be broken! One might be quick here to curse Opera for its terrible JavaScript support, and just leave it at that. Or one might investigate further to see what actually happens: The page discriminates against Opera.
I will avoid technical explanations, and simply explain how you can verify this yourself. By using a proxy to completely hide the fact that you are using Opera, the page will send you the same code other browsers get. Now, the menus will work fine in Opera! If you have the time, you can verify this yourself by using the Proxomitron to identify as Firefox (thanks to Andrew Gregory again).
The bottom line is that if only MSNBC had sent the same code to Opera as everyone else gets, it would have worked fine.
Taking action
Opera Software is actively working on contacting sites that block Opera, to convince them to make the often tiny adjustments necessary to make it work in Opera. A large and well known webmail provider fixed their broken pages by replacing "Opera" in their scripts with "xyz". It was a hack, but it worked.
You, too, can help! If a site doesn't work in Opera, contact the webmaster, and tell other Opera users about it.
In some cases, short term solutions are necessary to make sure important sites work, even if they have decided to block Opera. The next version of Opera, 8.0, will have two interesting features to help compatibility:
- A "Report a site problem" menu which lets you report sites that don't work in Opera
- An automatically updated list of sites that require normal or absolute spoofing (completely hiding Opera)
It is unfortunate that Opera's customers and users have to be inconvenienced by designers who apparently don't know what they are doing, or worse, know exactly what they are doing, and promote this kind of behaviour. But one thing's for sure: They can't blame Opera's "terrible" JavaScript support. Others are supporting Opera just fine, so that excuse simply doesn't cut it anymore.



porneL # 11. March 2005, 12:02
orinoco # 11. March 2005, 12:02
TreeGo # 11. March 2005, 12:02
rseiler # 11. March 2005, 12:02
Of course, even if that it is implemented, if a site really wants to tell what browser you're using, there are ways.
haavard # 11. March 2005, 12:02
Now, if the site goes out of its way to detect Opera even when absolute spoofing is used, then there isn't much one can say. The time they spent trying to block Opera could have been spent on testing the site in Opera in the first place. If the site is added to ua.ini, it will be functional as long as Opera is allowed to access the site, so all the webmaster really needs to do is to remove the part of the script that sends Opera broken code.
haavard # 11. March 2005, 12:02
porneL # 11. March 2005, 12:02
Nasty # 11. March 2005, 12:02
Also, the ability to override or switch off totally auto-spoofing would be very much helpful when debugging.
Without visual notification nor ability to switch it off we must look in ua.ini everytime we want to be sure that site is correctly done. It is an important knowledge for some people, although maybe not for typical end users.
Indyan # 11. March 2005, 12:02
Is there any possibiliy of that happening?
haavard # 11. March 2005, 12:02
> a page using the Ie engine if it isn't displayed properly?
> Is there any possibiliy of that happening?
Not a chance
For one, Opera is a cross-platform browser, while IE isn't. And we've got enough to do making sure Opera is secure, if we aren't going to have to start worrying about IE vulnerabilities being available through Opera too!
Anonymous # 20. February 2006, 03:08
"Why doesn't Opera go the Netscape way,and add an option to render a page using the Ie engine if it isn't displayed properly?"
There's already a button you can install in Opera that does this.
http://nontroppo.org/wiki/CustomButtons
yadavankur # 17. March 2006, 06:53
channon # 29. March 2007, 15:44
I just downloaded the old Opera version 7.23, the "live" version at the time this article was written, and ran it on my website that a customer (still using Opera 7.23) complained about not working properly. Sure enough, the JavaScript did not work properly in Opera for form processing - autofill the "ship to same as billing address" fields and other form submit aspects. I THEN implemented browser sniffing for the first time, and disabled several JavaScript features if the customer is running Opera and now it works fine, though with less functionality.
Therefore, I must conclude that, at least for the version of Opera that was being distributed at the time this article was written, "Opera has terrible JS support," and I will go further and point out that rather than address the problems promptly, Opera programmers decided to blame others for their shortcomings -- for example, this article.
Sorry Opera defenders, a spade is a spade.
haavard # 30. March 2007, 09:54
"If a site doesn't work, it could be because of a bug in Opera, so please report problems so that they can be looked into!"
Apart from that, a single bug/problem does not "terrible" make in my book, but thanks for the anecdote! My experience with sites that are problematic in Opera is based on several years of looking into these kinds of problems, though.
The point I was making with this blog post was that Opera does not and has never refused to handle broken or non-standard code.
Twey # 5. August 2007, 22:36
if(is_ie) {
myvar = document.all['someid'];
} else if(is_nav) {
myvar = document.getElementById("someid");
}
It sounds to me as if Andrew Gregory is suggesting that instead, something like this should be used:
if(is_ie) {
myvar = document.all['someid'];
} else {
myvar = document.getElementById("someid");
}
... or perhaps even this:
if(is_ie) {
myvar = document.all['someid'];
} else if(is_nav || is_opera) {
myvar = document.getElementById("someid");
}
... although I think that was just ambiguity on his part. None of these solutions are ideal. The best way to perform this sort of check is to check for the feature itself, rather than browsers known to have it; for example, the above code _should_ be rewritten as:
if(document.getElementById) {
myvar = document.getElementById("someid");
} else if(document.all) {
myvar = document.all['someid'];
}
... or to abbreviate somewhat:
myvar = document.getElementById
&& document.getElementById("someid")
|| document.all
&& document.all['someid'];