n 2004, I worked with a game publishing client that wanted to update their underlying XML-based workflow to allow writers at science fiction and gaming conventions to write reports into their laptops—even without an Internet connection. At that time, Firefox was becoming explosively popular, and I had been digging fairly deeply into the browser's XUL interface to better understand it.

Eventually, I managed to create a fairly sophisticated editor, and in the process learned a great deal about how Firefox worked. I also discovered that XHTML + JavaScript + CSS was just as powerful, more flexible, and often times better supported than XUL for many applications.

I found too that making add-ons for Firefox is not hard, but development can be tedious, especially as there is no formal development IDE for making them (Venkman comes closest, but it’s not very close). So, if you create a component, you have to build the XUL supports and overlays, bind in the JavaScript and CSS (and any XBL that's necessary to support things), then update one or more configuration files (which seem to change with every version). Then you have to zip the content up, rename the file, load in the new add-on, reboot the browser, and cross your fingers that you haven't done something that causes the browser to crash.

For larger scale applications, the benefits to create add-ons still apply, but it would be nice to create "quick and dirty" extensions without the rigmarole of binding, zipping, and updating; especially if the add-on is only to perform a basic task in the system—the analog of a system shell script.

This is the thinking that drove the R&D team at Mozilla to create Ubiquity. You can think of this add-on as a way to enable a command line for the browser. For example, I tend to write fairly wordy articles, and as more and more of my content creation has migrated to the web, I find it’s not always easy to tell how many words I've written in a block of text.

With Ubiquity, I can select the text and press Ctrl-Space (this is configurable) to bring up a command line "shell,"and then type in "word-count" at the prompt. This displays a reasonably accurate count of the number of words in the selection, just below the prompt line. If I press return, the command-line goes away, and the word count appears as a pop-up message in the lower-right-hand corner of the screen.

Ubiquity commands are written using JavaScript, and stored internally as local resources. In addition to the full JavaScript set normally available from the browser, Ubiquity also supports a number of additional functions to make reading or modifying pages easy. It also provides hooks to catch events such as mouse clicks, key presses, or page loads and unloads. In this respect, it bears a fairly strong resemblance to Greasemonkey, which runs scripts on documents at load time, but with the advantage that you can use Ubiquity scripts at any time, not just upon load.