Team LiB
Previous Section Next Section

Hack 78. Rebadge Firefox

Dig into Firefox and change some of its brand livery to something that suits you better.

This hack shows how to scratch the surface of the Firefox rebranding process. You can change many, but not all, of the obvious brand marks that Firefox displays with simple chrome hacks. For a really thorough job, you also need to rebundle the Firefox installer [Hack #28] with new brand information, and that must be done on top of a custom build [Hack #93] . It's not a trivial task to complete systematically. Here, then, are the easy bits.

7.5.1. Core Brand Information

Variations on the word Firefox appear in many places in the user interface: in menu items, in flyover help (tooltips), and even in HTML documents. Many of these places pull in the brand information from two files: brand.dtd and brand.properties. These two files are stored in the en-US.jar file in the install area: the default locale for a U.S. English distribution of Firefox. Pick a new brand name, modify these files in place, restart the browser, and see if the changes you need are completed or not.

7.5.2. Rebranding Bookmarks and Bookmark Text

The word Firefox also appears in the Bookmarks menu. To hack that menu, just remove the offending bookmarks:

  1. Create a new Firefox profile with the -CreateProfile command-line option.

  2. Start up that profile and open the Bookmark Manager.

  3. Delete all Firefox bookmarks and bookmark folders.

  4. Shut down Firefox.

Now, locate the bookmarks.html file in the new profile. Either migrate it to other profiles as required [Hack #25], or replace the standard one supplied in the Firefox installer [Hack #28] .

7.5.3. Rebranding Icons and Images

Some brand icons are easy to remove; others are not so easy. The simplest thing to do is to override the per-window icons that appear in the top left of the titlebar. They are also displayed by process managers such as Windows Task Manager and the Alt-Tab application picker.

To do this, create the following magic directory hierarchy in the chrome area: icons/default. Here's the full URL of that directory:

resource:/chrome/icons/default

In that directory, put icon files whose names match the id of the <window> tag for each Firefox window of interest. On Windows, these files should be .ico files; on Unix/Linux, they're .xpm files. As an example, the mail browser window, which is defined in chrome file browser.xul, has a <window> tag with id="main-window". The matching icon files should therefore be named either main-window.ico or main-window.xpm. To see it work, just restart the browser.

Icon files can be bundled with the installer, with extensions, or simply placed as required. There's more imagery than just icons, though.

On the easy side, there are Firefox images to change in the default theme in classic.jar. Look for icon32.png. There are several in browser.jar as well. There are also images to change in the standard install bundle [Hack #28] . Themes, locales, and extensions contain preview images that give away Firefox's true identity as well.

On the harder side, some copies of the Firefox desktop icons are embedded in the firefox.exe binary. Under Windows, you can replace these resources using a free tool such as Resource Hacker (http://www.users.on.net/johnson/resourcehacker/) or the equally free, but also open source, equivalent Resource Explorer (http://www.wilsonc.demon.co.uk/d7resourceexplorer.htm). On the Macintosh, the BNDL resource information is embedded in the source code, and Firefox source must be edited and recompiled to change this.

If you change the entries in the StringTable section, you also prevent your rebranded browser from sharing its runtime engine with Firefox. You also change the name of the browser when viewed in the Alt-Tab list and in the Task Manager.


7.5.4. Rebranding the User Agent

You can change the browser User Agent string using preferences [Hack #23] . The best place to put that preference change is in the defaults\prefs\firefox.js file in the install area.

    Team LiB
    Previous Section Next Section