Opera’s ‘Browser JavaScript’ feature
Monday, 07 August 2006Whilst reading Simon Willison’s latest post about how he’s sticking with Opera 9 as his main browser, I discovered something about Opera that I didn’t know before: it modifies the DOM and/or JavaScript of certain websites to make them compatible with the Opera browser. Opera calls this feature Browser JavaScript:
Browser JavaScript is a feature that allows Opera to automatically fix incompatible Web pages, out of date scripts, and pages that inadvertently block Opera.
The affected sites include some big names, including barnesandnoble.com, blogger.com and yahoo.com. The fixes range from small design tweaks to disabling browser sniffing code. In addition, a number of standard DHTML menu libraries are patched, regardless of the site they appear on.
Apparently this feature was included in Opera 8.01 but was turned off by default. It was enabled by default when Opera went ad-free, which was almost a year ago now. Given how long it’s been around, I’m surprised I haven’t heard of this feature before. Then again, I only use Opera for compatibility testing.
Some will day that this is no worse than Firefox adding undetectable support for document.all in order to support IE-only JavaScript. However, that was a passive fix that allowed non-standard code to go about its business; Browser JavaScript actively modifies the DOM and/or JavaScript of a site to make it work in Opera.
I’m not at all comfortable with Opera ‘fixing’ these sites in this way, even if they are doing so with the best of intentions. Who’s to say that the fixes created by the Opera engineers won’t break something else on another part of the site? And what happens when the site in question is updated? Are they going to test every area of every site regularly to check their fixes? Maybe, but probably not. You can be sure that the majority of users who complain about a broken site in Opera will do so directly to the site owner and not to Opera.
Incidentally, on the subject of good intentions, the quote from Opera above says that they’re fixing incompatible websites, not non-standards compliant websites. Does this mean that this is Opera’s solution to properly implementing CSS standards? I hope not.
The one saving grace here for us poor developers is that whenever a site is modified by the Browser JavaScript feature a message is posted to the JavaScript console. Still, if we find that Opera is causing a problem we have to email Opera and wait for them to fix it, which is less than ideal.
If you think Opera is modifying your page incorrectly or unnecessarily, or if you have removed the cause of the problems, please mail web-compliance@opera.com.
I can’t believe I’m the only one who’s concerned about this, but a quick google only turned up tutorials of how to write JavaScript for the Opera browser. Typical! I’d be interesting in others thoughts on this issue.








If the engineers at Opera have the time to design
Mark Scott | Monday, 07 August 2006 | 2:41 pmIf the engineers at Opera have the time to design this Browser Javascript thing, then why couldn’t they just spend the time to make their browser standard compliant?
This sounds a bit like the Firefox extension Greasemonkey, in
John Dowdell | Monday, 07 August 2006 | 3:00 pmThis sounds a bit like the Firefox extension Greasemonkey, in that both modify the page-creator’s instructions before displaying to the site’s visitor. True…?
John: Almost, except that with Greasemonkey the user of the
Steve | Monday, 07 August 2006 | 3:44 pmJohn: Almost, except that with Greasemonkey the user of the browser chooses to download hack scripts for a site (or creates their own.) Opera also has a User JavaScript feature which is exactly the same as Greasemonkey except in name, and I’m not bothered about that at all - power to the people!
In this instance Opera are hacking fixes for non-compliant sites and pushing them out to all users of Opera whether they ask for them or not. This is almost the antithesis of evangelism, and it concerns me greatly. How long before web developers start creating hacks to prevent the Opera hacks?
As for properly implementing CSS standards, Opera 9 was the
Paulo | Monday, 07 August 2006 | 10:29 pmAs for properly implementing CSS standards, Opera 9 was the second browser (Safari beat them to it) to pass the Acid2 test.
I agree with you that the JavaScript rewrites could cause trouble, though I would like to believe this is more benign (like the Firefox document.all fix) but who knows.
Oh, and did not know about it. Thanks for the
Andy | Wednesday, 19 December 2007 | 5:29 pmOh, and did not know about it. Thanks for the information …