The magazine of the Melbourne PC User Group

Running two or more versions of Firefox concurrently
Barry Andrews

 

This applies to Windows XP but can be adapted to other versions of Windows as well as Mac and Linux OS.
 
Now that Firefox 3.5 is here, I thought I'd upgrade to it as it is faster and more secure than its predecessor, version 3.0. But no sooner did I upgrade than I discovered some of my favourite plugins no longer worked, as their developers had not yet updated their code! If this happens to you, here is how to have your cake and eat it.

When you install Firefox in Windows, the default directory for initial installation and upgrades of the program's working files (firefox.exe, etc.) is C:\Program Files\Mozilla Firefox. However, Firefox's *settings* such as bookmarks and plugins are located in its Profiles directory, C:\Documents and Settings\[username]\Application Data\Mozilla\Firefox\Profiles. I have found it handy to create shortcuts to both folders (or maybe just the "Program Files" and the "Application Data" folders) in Explorer Favorites, for easy access.

In the Profiles folder is a subfolder named xxxxxxxx.default (where xxxxxxxx is a unique 8-character ID) containing your bookmarks, plugins and settings. So how can we install a different version of Firefox without overwriting our existing one? For this we need its Profile Manager.

Firefox's Profile Manager

Right from its early days Firefox has had a built-in Profile Manager to enable developers to run its latest beta versions as well as the current, stable version. Assuming you did a default installation of Firefox, copy the line below to your clipboard, then click Start -> Run, paste it in and press Enter: "C:\Program Files\Mozilla Firefox\firefox.exe" -ProfileManager

In my case I had already installed Firefox 3.5 but I wanted to be able to run Firefox 3.0 to get the plugins working again, and kept the Setup programs for each version on my hard drive. At this point we must decide whether to leave the default profile (v3.5) as it is and create an additional profile for v3.0, whether to rename the default to "Firefox 3.5" and create a new one named "Firefox 3.0", or whether to save the contents of the default, delete it and start afresh, creating a profile for 3.5 and another for 3.0? The first choice is the correct one, as you will see.

Before we get underway, try this simple test. Assuming Firefox is set as your default browser, open it and also a *non-browser* application (such as a Word document) containing web links. Click a couple of links and make sure each one opens in a Firefox tab or window, depending on the option you chose. If the famous "Firefox is already running" message (below) did *not* appear, you are safe to proceed, otherwise see the Troubleshooting section at the end of this article.

Taking the moz* off MOZ_NO_REMOTE

If you research the Profile Manager you may read about a Windows environmental variable named MOZ_NO_REMOTE, set to 0 (off) or 1 (on). Think of it as just a big switch that makes Firefox indifferent to the existence of another instance of itself, to which it would otherwise object! MOZ_NO_REMOTE was used with Firefox 1.5.0, but Firefox 2 replaced it with the -no-remote parameter, which does virtually the same but can be fitted neatly into Firefox's command line in a similar way to -ProfileManager.
 

Let's begin by creating a nice little shortcut icon to invoke the Profile Manager; you will use this technique later to create a startup icon for v3.0. Make a copy of the standard Firefox shortcut icon that's probably on your desktop or Windows taskbar, and rename it Profile Manager. Open its Properties and its Target should be "C:\Program Files\Mozilla Firefox\firefox.exe". Fine. (not forgetting the initial hyphen) so that it's exactly the same as the command used by Run, above.

Make sure Firefox is closed before running the shortcut, and the Profile Manager should open. This shows that the Profile Manager is really a little program hidden inside Firefox. (The extension -ProfileManager is called a parameter, a.k.a switch.) Finish by changing its icon to something more appropriate (hint: look in C:\WINDOWS\system32\shell32.dll).

Next, install Firefox 3.0 not in the default directory, but elsewhere; when you reach Setup Type, choose Custom and change the Destination Folder to C:\Program Files\Mozilla Firefox 3.0, also changing its Start Menu Folder to Mozilla Firefox 3.0 to avoid overwriting the default. Don't run it after installation. Now we will create a profile for it.

You might ask, how can we make sure the new profile opens FF 3.0 and not 3.5? The answer is that the profile is independent of the actual version used. Let's see how it works. Run Profile Manager and create a new profile named firefox30 (case is unimportant here, but avoid spaces in the name or you will have to enclose it in double quotes). When finished, the Profile Manager window should look like this (at right):

while your Profiles Folder should now contain a new folder named xxxxxxxx.firefox30.

Now, make another copy of your Firefox shortcut, this time appending -no-remote -P firefox30 to the Target so that it reads:
"C:\Program Files\Mozilla Firefox 3.0\firefox.exe" -no-remote -P firefox30.

You can work out that this shortcut will open FF 3.0 while the -P (Profile) parameter directs it to use firefox30. We could have left it at that and enjoyed being able to alternate between different FF versions, but with the -no-remote parameter we can run them concurrently!

There's one catch to this arrangement, though. As the Mozilla KnowledgeBase states(http://kb.mozillazine.org/
Opening_a_new_instance_of_Firefox_with_another_profile), "Be aware that you can't send links from an external program to a Firefox instance that is started with the -no-remote switch, or if the environment variable MOZ_NO_REMOTE is set." That's why we test activated an external link first. This limitation simply means that you have to *copy and paste* such links into concurrent instances of Firefox instead of activating them directly. For this reason I advised you not to alter the default installation as this is where you will need this ability most. If you decide you need remote link activation in v3.0, you could create two shortcuts, each using 3.0 and the firefox30 profile, but only one including the -no-remote parameter.

Finish by renaming this shortcut "Firefox 3.0" and assigning it a distinctive icon, if you wish.
 

The big moment arrives

Now it's time to test your work. Clicking the default "Mozilla Firefox" icon should bring up 3.5 with your bookmarks and other tweaks. Without closing it, clicking the "Firefox 3.0" icon should bring up 3.0 as a brand new installation in a new window, minus bookmarks and plugins, of course. Now you can add that favourite plugin, a copy of your bookmarks (use Organize Bookmarks -> Restore from your Default profile), set the home page, and you're ready to go!

Buoyed with this success, I went on to create a third profile named webdesign, for my SIG group, using v3.5 to run it. This offers the benefit of having customized bookmarks, fonts, etc., entirely separate from my own personal profile. I could of course have opted for a Windows User named Webdesign, but this wasn't necessary.

Troubleshooting

If the dreaded "Firefox is already running" message locks you out despite your best efforts, there are several steps you can take to clear it. First, try simple rebooting. Firefox normally creates a zero byte file named parent.lock (in Windows, different names in other OS) which prevents you from opening a second instance of it (not a second window). If Firefox crashes, this file may not be removed; you may have to delete it from your profile folder, or kill the Firefox process if it is running and start again. On one occasion, nothing worked until I installed 3.0 over 3.5, which fixed it. I then reinstalled 3.5 and continued normally, re-testing links as I progressed. This may work for you. There is plenty on the Web about this - Google found it mentioned in over 34,000 web pages!

*"To put the moz on": To put an evil influence on a person; to jinx. Moz is an abbreviated form of mozzle, a borrowing from Hebrew mazzal meaning ëstar or luckí. It probably came into Australian English via German Yiddish speakers. First recorded 1924.
http://www.anu.edu.au/ANDC/res/aus_words/aewords/index.php

About the author:
Barry Andrews is the convener of the Web Site Design SIG which meets on the 4th Tuesday of every month.
 

[ About Melbourne PC User Group ]