Archive for the 'googleig' Category

Adventures with UWA

Saturday, August 11th, 2007

Following a friend’s (Alex Sirota) recommendation I’ve started looking into widgets as an additional presentation layer for my pet project. I must admit that I did not take the time to research all the available widget environments but rather plunged right into one of the first few I’ve tackled - NetvibesUWA (Universal Widget API).

What immediately appealed to me was the U in UWA that stands for Universal. Universal is such a lovely word. It promises so much. Just by the sound of it I’ve started imagining numerous platforms all coalescing to execute my widget.

In the real world, however, UWA 1.0 mainly supports the following: Netvibes, Google IG and Apple Dashboard. It is also possible to host UWA’s widgets on your own website and blog (lookie down below).

3 facts about UWA:

  • It needs to be XHTML
  • It is client side only technology
  • It forces all javascript code to be included within the widget file when not working within a iframe

I’ve started playing with UWA. For learning purposes I’ve tried to produce a widget for phash (phash is described in my previous post). This was a good choice for starting out with UWA since phash’s widget is client side only. Developing the widget was a breeze, although, I had a couple of rough hours adding it to my Netvibes page. Turns out that UWA does not enforce XHTML when working ’standalone’ (development mode where you execute the widget from your own http server), but does very much so when working online.

Invigorated by recently solving the missing ‘/>’ problem on my phash widget, I’ve started looking into developing a widget for my current pet project, which was the real purpose of my UWA incursion. To my demise, I found out that there is even more difference between ’standalone’ mode and online mode.

UWA allows to fetch data from server side via ajax operations. The ajax wrappers are nice and simple, however, when working ’standalone’ there are some quirks to workaround. These quirks make the whole ajax experience in UWA somewhat uncomfortable. I found myself spending several hours making all of my ajax calls work.

For starters, when working in ’standalone’ mode, there is a need to delegate all ajax operations to a proxy. The proxy’s code is rather simple and can be found in UWA’s documentation.

Next, I’ve tried to use JSON in ’standalone’ mode and failed miserably. After a couple of hours I’ve learned that working with JSON in ’standalone’ requires disabling a proxy workaround by setting the following: “UWA.Data.useJsonRequest = false;". I couldn’t find this documented anywhere.

Another thing that was kind of painfull was the password field. Password fields are stored on the Netvibes site when in online mode or in cookies when in ’standalone’ mode. They are virtually inaccessible after authentication phase and they cannot be used when the widget is hosted on a blog or a website.

Overall, UWA is nice and easy, in spite of the annoying differences that are required in the code for the different targets the widget is hosted on.

One last thing: when hosted on a blog the widget seems to be a bit uglier than its counterpart on Netvibes. This probably can be fixed with enough time spent.

Down below you can find the first fruit of my labors with UWA.

Update: I removed phash widget from this post since most aggregators do not support a widget embedded within a post. I’ve put a new page with phash widget embedded within for you to see.