Home · Professional · Browsers · Firebird (Phoenix) · Kiosk Browser · XUL and Firebird

XUL and Firebird

Previous · Next

Working with browser.jar

Now that we've made all of our interface and preferences changes that we can through the browser interface, we can close the browser and start hacking the code. Once you've closed Firebird, browse to the main MozillaFirebird directory and open the subdirectory "chrome". The chrome directory is where Firebird stores all of its JAR files. In these JAR files are packaged all of the XUL, JS, CSS and image files necessary for defining the browser interface, its various elements and how they look and behave. In this tutorial, we will be working exclusively with the browser.jar file.

Use your zip utility to open up browser.jar. You'll see that this JAR file includes dozens of files of various types. To allow us to edit the XUL files, we need to extract the contents of browser.jar. I recommend extracting those files into a different location than where you installed Firebird. This will make it easier to keep track of the files that we are working with and the changes that we have made.

Introduction to browser.xul

Once you unpack the JAR file, browse to this directory:

...base directory\content\browser

and locate the file:

browser.xul

This XUL file is the main file the Firebird uses to define the main browser interface, toolbars, context menus, commands and keyboard shortcuts. Because we are going to disabling access to other elements of the interface, like the Help function, we don't have to worry about any other XUL files. However, if you do allow access to other elements, you may need to edit those other elements in line with what we cover in the tutorial to secure them against tampering. Let's start by opening browser.xul in a text editor.

Structure of browser.xul

One of the nice things that the Firebird crew has done is organize the browser.xul file into sections corresponding to various elements of the interface and the related functionality. Generally, the order is:

Command IDs: Control global commands that can be executed from the interface
Key IDs: Actions that can be executed using keyboard shortcuts
Context Menus: Menus that appear when you right-click on various elements or in response to different actions
Toolbars: Define browser toolbars
Menubar Menus: Menus that display in the menubar
Toolbar buttons: Buttons that appear on the toolbar

As we work our way through browser.xul, I'll explain how changes to the various section affect the look and behavior of the browser. I've included a commented copy of browser.xul for reference as we go through our changes. Print out or download it so that you can see the comments and changes as we go along.

Working with XUL

Generally, we won't be editing the actual XUL code itself. Instead, we will be using standard HTML-style comment marks to "comment out" the code. By placing the code into comments, it becomes invisible to the application. When the code is processed by the application, it won't display or respond to the commented code. Using comments also gives us the ability to go back and uncomment any changes we have made if our changes have unintended side-effects. You could also simply delete the code but that makes troubleshooting a much more difficult task!

When using comments, you need to be precise with how you type them, otherwise, they won't be processed correctly. I've found that the application expects the opening comment tag to include two dashes after the exclamation point so that it appears as:

<!-- Start your comment here...

If you use fewer or more dashes, the browser will throw an error message when it launches. Likewise, the closing comment tag should only include two dashes like this:

-->

Another thing to watch out for is nested comments tags. If you nest comments, you will get errors. Either remove the inner set of comment tags, or regroup them so that the comments are not nested. You'll have to decide which works best for you. You can span comments across more than one line of code. This is very helpful for commenting out large blocks of code. Finally, good coding practice encourages the use of descriptive text with your comment tags. This will help remind you of the what and the why of your changes.

Previous · Next

Last updated: December 31, 2003
Created: December 1, 2002

If you are reading this, your browser probably doesn't support current HTML and CSS standards. While the site looks much better in a browser that supports web standards, you can still access all of the information that is here with any browser or Internet device.

Hosted by www.Geocities.ws

1