Creating Applications with Mozilla
by David Boswell, Brian King, Ian Oeschger, Pete Collins, Eric Murphy
Chapter 2. Getting Started
To help you start creating applications as quickly as possible, this chapter presents two “Hello World” examples that demonstrate the beginning stages of Mozilla application development.
The first example is a simple XUL file that is loaded into the browser window. This example is then expanded on by adding additional features to the XUL file, such as imported stylesheets and JavaScript functions. The second “Hello World” example shows how to turn files like these into packages, which are the modular, bundled sets of files that fit together to make Mozilla applications or new modules for the Mozilla browser.
These examples provide a context for discussing the development of Mozilla applications. The first example focuses on creating and editing the basic file types, and the second focuses on the organization and distribution of applications on the Mozilla platform.
2.1. Simple XUL Example
Like all good “Hello World” applications, Example 2-1 shows one of the simplest possible examples of XUL. Although it is small, it demonstrates some important aspects of XUL programming, including the use of event handlers to add behavior and the use of a box to lay out elements properly within the window. This example also provides a context for discussing more general features of the language, such as the file format, the namespace, and some XUL programming conventions.
Example 2-1. Hello xFly
<?xml version="1.0"?> <!-- Sample XUL file --> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access