Mozilla Labs last week released a new version of Prism, a single-site browser system that brings web applications to the desktop. The latest version is designed to work as a Firefox extension rather than as a separate XUL application.

Prism makes it possible to launch web sites from the desktop and load them into a simple browser window without all of the extra features and functionality of a regular browser. This is advantageous for users because it allows them to run those sites in a separate process from their regular Firefox browser and interact with the content without any unnecessary distractions. Prism also allows web application content to be customized in some ways to make it more conducive to desktop use.

After installing the Prism extension for Firefox, users can select the Convert Website to Application item from Firefox's Tools menu to bring the currently active site to the desktop. The website conversion dialog allows users to specify a name for the web application and also to choose whether or not to show the location bar and progress bar. Prism will then create a shortcut on the desktop with an icon selected by the user.

For testing purposes, I used Prism to create desktop shortcuts both for Twitter and for Clint Ecker's SteveJobsIsYourNewBicycle.com web application, both of which worked well.



Twitter running in Prism



Creating a Prism webapp

Prism does more than just provide a lighter interface for interactive web applications. Developers can create custom Prism webapp bundles that include additional JavaScript and CSS for manipulating the content of the web sites. Developers can add a webapp.js JavaScript file to a webapp bundle to perform custom programming within the Prism chrome window. This code runs with chrome-level privileges (much like a Firefox extension) so it can use Mozilla XPCOM components to read and write files to the local filesystem and perform other system-level activities. The webapp.js script can also be used to add sidebars to Prism applications. In a blog entry, Mozilla developer Mark Finkle demonstrates this feature by showing how to add a Google Talk sidebar to a Google Docs webapp.

Firefox 3 offers many advanced capabilities that provide a rich foundation for desktop web applications. It has basic support for offline web applications, for instance, and it implements some relevant features from the WHATWG Web Applications specification, including offline events and DOM Storage. The DOM Storage feature provides basic support for data persistence between sessions, and some developers are also experimenting with integrating Google Gears into Prism applications. Prism supports the same framework for extensions as Firefox does, so it is likely that additional functionality for more elaborate customization will emerge from the developer community.

According to Finkle, Mozilla's plans for future versions include adding support for minimizing to the tray and adding a new JavaScript API that will expose more native system functionality directly to web applications.

Although Prism provides some compelling mechanisms for manipulating web content, it still requires the content itself to be hosted in the cloud. Developers who want more flexibility or a standards-based technology that will allow them to use web development techniques to create cross-platform desktop applications that load from the local filesystem should look instead to Mozilla XULRunner, which allows developers to create entire native-looking applications using JavaScript and XML, with support for seamlessly interspersing both local and remote XHTML and SVG content.

Prism remains a nascent and still-experimental technology with limited uses, but it's a good start that provides a usable foundation for single-site web browsers. As Prism evolves and becomes capable of exposing more native system capabilities to web applications, its usefulness will grow considerably.

Further reading