Opera, rewriting the Web one site at a time

0

Posted by Rob | Posted in BBC, Browsers, Javascript, Opera, Work | Posted on 13-09-2011

Tags: , ,

Opera Web Browser

Opera Web Browser

I work for the BBC and we work very hard to make sure anything that the public see is of the highest standard, and we’re always working to improve that methodology over time. Yes, like any live and evolving website, the occasional bug does slip through the net. We do our very best to prevent it, having a dedicated team of User Experience and Functionality testers, along side a team of people writing automated tests and software. But bugs can occasionally happen.

When we do find a bug, especially with a new feature, we identify and fix the problem as quickly as possible. This is where I come in. As a developer, part of my job is to do the finding and fixing.

So I was handed a bug to look at. The video was not appearing for some Opera users. I talked over the situation with our QA manager, and discussed just how long the fix should take, how we’re going to roll it out and what impact it will have on users until then.

That having been sorted, I started work on my side of the problem. When I finished, I found my fix only served to create another problem. And another appeared. And another, and another.

By chance, I switched off a setting called “Browser JavaScript”. Suddenly, everything starts working. I just sat there stunned. “What just happened?” I started asking myself. I switch Browser JS back on, and it breaks again. So I started running around the office looking for anyone with Opera to test out this problem.

I found that roughly 50% of users are seeing the same results as I was. The other 50% haven’t got a problem.

So I start reading up about browser JS and start having a look at the file directly. Lo and behold, there is a direct mention of BBC iPlayer. They’re rewriting a core browser JS function. “What the hell?”, you could rightly ask.

} else if(hostname.indexOf('bbc.co.uk')>-1 && pathname.indexOf('/iplayer')>-1){ // PATCH-426, Add to favourites fails on BBC iPlayer because of script loading/parsing timing issue
	document.getElementsByTagName=function(n){
		var elms=getElementsByTagName.call(this, n);
		if(elms.length==0 && n=='body')return [document.documentElement];
		return elms;
	}
	if(self==top)postError.call(opera, 'Opera has modified the JavaScript on '+hostname+' (Add to favourites fails on BBC iPlayer because of script loading/parsing timing issue). See browser.js for details');

They’re rewriting a core function, built into the browser, and it’s worth noting that this isn’t a problem with iPlayer that they’re fixing. It’s a problem with Opera that they’re working around for only iPlayer.

I did a little research and found this blog, my.opera.com/core/blog/show.dml/3130540 (Update: Can anyone tell me why this only loads in Opera?) from Opera, stating:

“Opera has more experience with site-specific patches than other browser vendors, since we’ve been patching the web since Opera 8.01. I believe our solution is also by far the most advanced one”.

Did I just read that right?  Opera are better at developing websites that anyone? That’s an unbelievable statement to make.

What about GreaseMonkey, you might ask. GreaseMonkey is a great little tool for letting users add functionality to websites that they think is missing. Opera are taking that idea and forcing it onto their users by default. It’s not even opt in.

Conclusion: I’ve met some of the Opera people before today. Bruce Lawson is a particularly fine chap. Which is why I’m confused why they would think that as a software development company, not only do they know web development better than web developers, but that they have a duty to edit those sites which fail in their browser.  The correct course of action, for me, would have been to contact us directly and report the issue.  I just hope they do this in future.

Update: We got an apology my.opera.com/sitepatching/blog/2011/09/12/why-we-broke-2 from Opera which was extremely nice of them.

Update: The apology managed to get to #10 on Hacker news :)

JS Table Sorting for BBC Glow – v1.3 (Updated)

6

Posted by Rob | Posted in BBC Glow, Code, Javascript | Posted on 01-04-2010

Tags: , , ,

Morning all, I’ve recently started working for the BBC, and as such I’ve started working with the internal JavaScript framework, Glow.

So this is my first attempt at writing to some code with it. I hope it’s useful to someone. It’s just a simple JavaScript table sort.

The Introduction

Just a bit of useful script for client side sorting of tables. Simple click the headers of the columns, and it will arrange it in ascending order. A second click will arrange it in descending order.

As Seen On…

BBC News Common-Wealth Games Medals Table : In English, In Urdu, In Hindi, and on BBC Worldwide

UPDATE – 30th July 2010: After talking with a BBC colleague, it occurred to me that I could improve the code, so that it doesn’t rely on the class names for the ordering. The class names are now purely for decoration, not functionality.

UPDATE 2 – 30th July 2010: It was just pointed out by James (thanks man), that Glow/JS doesn’t handle number sorting brilliantly, so I’ve added a small patch to improve this. Thanks to James for his suggestion.

UPDATE 3 – 3rd August 2010: Some alterations to improve sorting of floats.

Read the rest of this entry »

Ajax Content for MooTools v1.2 (Facebook Style)

1

Posted by Rob | Posted in Code, Javascript, MooTools | Posted on 22-10-2009

Tags: , , , , ,

Welcome to my second attempt at writing up a mootools class. This one’s a little more advanced this time.

It attaches an Ajax handler to all links on a page which conform to the selector you give it. For example, you can tell it to attach to all standard links (<A HREF=’/here/’>Hello</A>), or links with a specific class as i’ve done with the code below (<A HREF=’/here/’ CLASS=’ajax’>Hello</A>).

I hope someone finds this useful. As ever this was created after I kept saying that I could write something a hell of a lot better than anything else I was finding. This might be a bold statement, but I was having trouble finding anything that would do the job, and simply.

Read the rest of this entry »

Moodal Window for MooTools 1.2.3.1

3

Posted by Rob | Posted in Code, Javascript, MooTools | Posted on 24-09-2009

Tags: , , ,

MoodalWindowThis is my first attempt at publishing one of my scripts, and my first real attempt at writing a MooTools class.

I hope you enjoy it, and check out the demo:
Read the rest of this entry »