Opera Binary Markup Language
OBML is a feature available to Opera Mini and browsers created using the Opera Devices SDK 9.6 (all built upon the Presto 2.1 rendering engine)—when OBML is used to render a web page, instead of the whole page being downloaded to the device and rendered it is transformed into the ultra-compact OBML format then sent to the device, which reduces download sizes by up to 90%. This offers obvious advantages to those using devices with low memory or low power, who may also be downloading on slow networks. It does however have caveats that you need to be aware of, in terms of how it renders web technologies.
In this article I’ll cover how the OBML system works, and discuss what caveats there are to be aware of with OBML.
How OBML works
When a browser rendering using OBML requests a web page from a server, the following occurs:
- The web page request is sent to a large, power server farm.
- This server farm retrieves the requested web page, and converts it into OBML
- The OBML version of the page is sent to the browsing device, and displayed in the browser that originally made the request
If the browser does not have available plugins such as a download manager, a video player or a music player, it will usually try to use the device’s own functionality to deal with such things, if it has such functionality available.
CSS and HTML
- Limited support for DOM events
- No background scripting
- Very limited Ajax support
We’ll look at this in more detail in the sections below.
All scripts executed before a page is fully loaded will work as expected when your page is loaded in Opera Mini. This includes manipulation of elements in the DOM tree. Furthermore, the
onLoad event is fired and its code executed in the OBML server farm before the page is transferred to the client.
The only caveat to consider here is that we don’t allow scripts to run for more than a second or two once the page has finished loading, and will not allow any scripts to run before the user does some kind of user interaction (such as click a link or submit a form)—therefore
delay() are disabled. The same is true for xmlrpc requests—they work but are only allowed to run for a few seconds. Once the page is sent to the device, all scripts are stopped.
setTimeout is not possible.
The supported events are as follows:
- Loading: normal event processing is done for
onChange: this even works during filling out a form, not just on submitting the entire form. For example, if you have 2 form fields, “Select Country” and “Select State/Region”, and the second one changes depending on the country you selected in the first one, the OBML will reload to display this change
onClickon buttons (bear in mind that events will only be fired when the form is finally submitted, not while it’s being edited in the client, therefore
onFocuswould not work)
onClickis implemented as a mouse motion to the coordinate being clicked (
onMouseLeaveetc) followed by
Other events are ignored/not applicable, for example:
- key/mouse events (
- focus events (
onFocus, as mentioned above)
Given device limitations and OBML’s client-server architecture, Ajax applications cannot be expected to work as expected on OBML browsers.
XMLHttpRequest is supported, therefore many Ajax-powered sites will function pretty well, for example iGoogle (you can’t move boxes around, but you can add and delete them, and change themes,) and GMail (this mostly works, although you don’t get new mails appearing automatically.)
Sites that use Ajax to trigger very regular page changes however, such as Google Suggest and the automatic new mail functionality of GMail mentioned above won’t work. Other examples of things that don’t work are IRC-like chat-clients using server-side events, and clocks.
As mentioned above, client-side events are limited to form changes (
onClick) and clicking (
onClick, links, submits, etc.—everything you can do by clicking with a mouse,) so things that react to user input (clicking, or changing form values) usually work, unless they need to see each individual character inputted (eg Google Suggest,) or react to changing state in the outside world (eg new mail, new text message, end of the world, the time, etc.)
What it all boils down to is that once a page has been rendered by the server it won’t change until the user clicks something.
In this article I have covered OBML, including how it works, and the caveats you need to consider when developing web applications to run in OBML browsers.