Search This Blog

Friday, October 5, 2007

Browser Extensions Using XUL: Firefox Browser Extension With UI Features

The Mozilla project's XUL engine is a user-interface language that you
can use to extend Mozilla browsers, or to build stand-alone applications.
XUL is a surprisingly easy way to build cross-platform browser extensions.
This article puts together the basic pieces you'll need to create most
extensions with user-interface features: XUL, CSS, JavaScript, and DOM.
The Mozilla project team very early decided that it would standardize
core development in C++, but that it would create a component system,
XPCOM (Cross Platform Component Object Model), for sharing core and
extension functionality across platforms. It also developed a means of
designing user interfaces for such components in a platform-neutral
language it called XUL (XML User Interface Language), pronounced "zool".
A companion language, XBL (Extensible Bindings Language), is used to
control dynamic behavior of XUL elements. XUL and XBL are powerful enough
to develop a full browser or other full, cross-platform applications
based on Mozilla components, but for most developers XUL is used more
modestly to extend or manipulate the user interface of an existing browser
or other application -- a use case for which XUL was carefully designed.
This is most often the case when you are developing a browser extension,
and the most attractive target for most Mozilla browser extensions is
Firefox, Mozilla's very popular stand-alone browser. Firefox is built in
XUL and JavaScript. One of the great things about XUL is that Mozilla
browsers treat it, for the most part, like any other Web content. This
means you can rapidly try things out and deploy things during the
development phase, before worrying about proper packaging into
applications or full extensions. XUL has a wealth of UI elements and
each one has a wealth of attributes and properties, adding up to a
generous toolbox for building applications and extensions. Loading XUL
directly into the browser is a handy way to rapidly prototype and
storyboard XUL applications, but once you start manipulating things with
script you may run into unpredictable difficulty. Luckily you have the
option of XULRunner, a stand-alone tool created by Mozilla developers.
XULRunner can run XUL files outside of any browser, thus avoiding the
stringent security model. It's definitely a developer's tool, and can
be a pain to get working, especially on some platforms, but it's an
important option for developing and deploying XUL projects.

No comments: