Hack 94. Run Multiple Mozilla Browsers
Run as many Mozilla browsers as you want on your single desktop.
Unless you're extremely technical, Internet Explorer 6 is a one-shot affair: either you install it once or you don't install it at all. Firefox is not like that; you can install many versions and related products and pick between them as you see fit. There remain one or two combinations to avoid, as we'll point out in this hack.
9.5.1. Running Different Browsers Simultaneously
To run the Mozilla Application Suite, Camino, Galeon, Compuserve, Netscape, or Epiphany on the same computer as Firefox, just install both products in separate directories. You can run both products at once. You can do that with Firefox and Thunderbird as well, or with Firefox and Nvu, or with Firefox and Komodo. However, there is one combination to avoid.
Mozilla-based browsers do not yet fully support profile sharing between products. Firefox and Thunderbird are a partial exception, since they overlap only in a few profile files, such as the certificate database. If you run two Mozilla products that use the standard profile system and the same profile, it's possible, but not likely, that you will corrupt the profile if you make extensive configuration changes. You could lose your bookmarks and other content.
To solve this problem, use the -CreateProfile command-line option to create a separate profile for each product. Change shortcuts and menu items so that they call each product with the -Profile profilename option.
Some of the information stored by Firefox is not used by the Mozilla Application Suite, and vice versa. Bookmark detail and some RDF information are two examples. In general, starting the wrong product against a given profile is fairly harmless; the extra, unknown information will simply be ignored. For Firefox 1.0, there have been few changes or no changes in the file formats of common profile files. Read the release notes for future versions to see if planned changes to the profile system have taken place yet.
9.5.2. Running Two Separate Versions of Firefox
As in the previous case, you can install two separate versions of Firefox and alternate between them. By default, you can't run them in parallel on Windows. However, there's no problem doing so on Unix/Linux. Here are two sources of unwanted behavior:
Nightlies and debug versions are mostly used for testing, and it's possible to construct tests that destroy the only displayed browser window without also shutting down Firefox. That leaves the browser running invisibly in memory as though it were a server. It then has to be found and killed by hand. If you're running several versions of Firefox, this behavior can be a major source of confusion. It's another good reason to treat nightlies with care.
9.5.3. Running Two Instances of Firefox Simultaneously on Windows
The problem of two simultaneous versions of Firefox on Windows can be solved with simple hacks. Once one (or more) installation of Firefox is hacked, you can run two (or more) separate instances. You can do so even if the two instances are the same version.
188.8.131.52 Temporary solution
Window users who use one instance of Firefox as their main browser and wish to debug another instance can do so with an environment variable. Simply set the environment variable MOZ_NO_REMOTE=true to run the two Firefoxes simultaneously (see bug 131805). Put this variable in c:\autoexec.bat or equivalent.
184.108.40.206 Permanent solution
To put this hack in place, first grab a free Windows executable editor, such as Resource Hacker (http://www.users.on.net/johnson/resourcehacker/) or Resource Explorer (http://www.wilsonc.demon.co.uk/d7resourceexplorer.htm).
Next, locate the Firefox binary firefox.exe in the install area. Open it with your editor and drill down to the 102 and 103 entries in the StringTable section. Change these values to an alternate value, such as Myfirefox. Figure 9-1 shows this section of the resource fork of the binary.
Figure 9-1. Unique instance names inside the Windows Firefox binary
Save the changes: choose Compile Script and select FileSave. Now you're ready to start up the modified Firefox. Just run it as normal.
9.5.4. Running Only One Instance of Firefox on Unix/Linux
On these platforms, the problem is rather the reverse of Windows: by default, any command-line invocation of Firefox will start a whole new browser instance. You can get around that, too.
Quite often, nonbrowser programs have to open web pages. An example is when the user clicks a Help link. Those programs would rather that such pages display in the user's currently opened browser than start a whole new browser instance.
On Unix/Linux, Firefox supports an xremote feature to make this possible. It allows you to configure these other programs to drive Firefox in a programmatic way. This can have an effect different from defaults offered in the preferences. For example, another program can instruct Firefox to use a new tab for the required page if there is a current Firefox instance already running, or else launch Firefox and open the required page if it's not running. The following script does so:
#!/bin/sh mozilla-xremote-client -a firefox "openURL($1,new-tab)" || firefox "$1"
The mozilla-xremote-client binary (provided on Unix/Linux by default) is a small tool provided with the standard Unix/Linux Firefox install.
If, for example, you save the preceding script as a file named openlink and give it executable permissions, you can then configure other programs to run it as required:
Other options possible with this script are noted here: http://www.mozilla.org/unix/remote.html. Beware that this page is slightly out of date; mozilla-xremote-client is the correct tool to use.