Thursday, November 1st, 2007

How JS & Ajax work in Opera Mini 4

Category: Opera

Chris Mills, Opera’s Developer Relationship Manager, goes into great detail about Opera Mini 4’s support for JavaScript and Ajax.

Opera Mini is a very clever way of bringing the web to your mobile phone – it will work on most phone models, even low spec ones, as long as they will run a JVM. Basically, when you request a web page from Opera Mini, a request is sent to the Opera Mini servers. They retrieve the page, convert it into OBML (Opera Binary Markup Language,) a very compact binary markup format that reduces the page size by up to 90%, and then serve it to your phone….But what about JavaScript?

The areas covered in his article include:

  • How Opera Mini interprets JavaScript
  • Server-side support
  • Client-side support
  • Ajax support

One key point that jumped out at me is that the Opera Mini servers have full support for ECMAScript 4 on the server-side but is hindered on the client side by the limitations imposed on individual handsets.

After the page has been transferred to the client, things are a lot more limited – basically all events are processed on the server. The client does absolutely no JavaScript processing at all, and instead the page is kept in the server (basically the client works as an input device for the opera running in the server).

My reaction was obviously that this is a major limitation but Chris goes on to give this perspective:

This sounds limiting, but there is another point to consider – Opera Mini can execute JavaScript on the server if it’s triggered by the JavaScript events listed above in the client, so some complex pages work surprisingly well – for instance Facebook is able to display popup menus and popup dialogs very well on Opera Mini.

There are also some considerations when trying to use Ajax, as the Opera Mini architecture handles Ajax requests slightly differently based on the expected functionality. Chris cited the use of automated page refreshes as a possible sticking point.

As with any mobile device or browser, a lot of homework needs to be done when developing for Opera Mini but it looks like Opera is making some good strides towards easing that pain.

Posted by Rey Bango at 6:30 am

3.4 rating from 30 votes


Comments feed TrackBack URI

“… full support for ECMAScript 4 on the server-side …”
it smell to a rhino…

Comment by el_vartauy — November 1, 2007

Wow, this is exactly what I was looking for — Opera Mini JS Detail. Many thanks, Rey. Dev.Opera’s been interesting as of late. Onto the coding!
“…full support for ECMAScript 4…” – I know it, for fun, just run through Opera Mini and watch it pass (!) with flying colors!
More phone-y jQuery to come…

Comment by Charles — November 1, 2007

What does “it smell to a rhino” mean?

Comment by eh — November 1, 2007

@eh: spanish to english translated idiom.
What he means to say, to use the english idiom:
“…server-side ECMAScript 4…”? Sounds like Rhino to me.

Comment by Charles — November 1, 2007

But what is “rhino”? What does it mean that it sounds like rhino?

Comment by eh — November 1, 2007

Rhino is Mozilla’s java based JavaScript implementation:

They have support for ECMAScript 4? Isn’t that still being hammered out?

Comment by Chris Double — November 1, 2007

Opera Mini 4 is very cool… It’s fast, renders well, AND it saves me on data transfer costs. Nice one Opera :)

Just waiting for Opera 9 Mobile now too… hehe…

Comment by Justin Carter — November 1, 2007

I somehow doubt that Opera’s JS implementation is available as an open-source project :)

Comment by eh — November 2, 2007

Hey, thanks for posting this here Rey! We’ll have a lot more interesting stuff coming up on in the future too. If you have any questions or comments about Opera and it’s software, or any suggestions for articles you’d like to see on, feel free to drop me a mail at cmills [at] opera [dot] com

Comment by Chris Mills — November 2, 2007

Leave a comment

You must be logged in to post a comment.