Add-on and Mashup Development: Leveraging 3rd-Party APIs


Mozilla Firefox

Image via Wikipedia

An add-on in Firefox is Javascript, XUL, and CSS. Any part of the Firefox UI can be modified by an add-on. Version control is built-in as is an upgrade mechanism. Platform APIs allow an add-on to access anything on the machine. That's good and bad. There are security issues, but it makes add-ons very powerful because you have full access.

One of the nice things about moving a mashup into an add-on is that you do away with many of the cross-site scripting restrictions that make mashups hard, or even difficult.

Much of what you do is the same. Javascript, DOM and XUL are pretty much the same and work as you'd expect. What changes is the ability to do XHR calls easily and in the background. JSON can be encoded and decoded as functions rather than using eval. Avoid using eval inside plugins because of the upgraded privileges that add-ons enjoy. As an add-on you run in the context of the browser window (chrome) so you have access to both the chrome and content windows. Avoid allowing content window scripts to access the chrome.

Tools for debugging include Firebug and LiveHTTPHeaders. Venkman allows you to debug Javascript code inside the add-on (not just the page).

Some examples: Ubiquity, Snowl, Zemanta, Operator, and lots of Twitter and weather related examples. And of course, don't forget Kynetx.

Some resources: