How to ensure specific Firefox Profile opens HTML extension file?

  • WinXP 64bit; Have Multiple Firefox Profiles, each running multiple tabs & windows, on specific topic/purpose
  • Sometimes these tabs run in hundreds, adding to increased load & exit delay (+ data transfer costs/delay when starting FF )

.html file is associated with Firefox (Default profile) So opening such file will fire up default profile (with hundreds of tabs, data loading, delay & stuff), which is not good.

How to associate this file with a specific profile (which is session-less & will fire up quick) ?

TRIED:

  • In folder options> File Types> HTML > Open Command, tried editing to "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -osint -url "%1" -p 8 -no-remote where 8 is the name of needed profile. But still opens with default profile
  • Only option i see without any answers would be to shelve using default profile and keep it for this purpose & do work on other profiles

EDIT

just saw something similar Start firefox using Another Profile, for specific file type(s)? 2yr old, please vote up or help guys


Solution 1:

The simplest solution is to use a batch file. The following was tested and confirmed to work with Firefox 30.0.

Associate .HTML Files With a Specific Firefox Profile

Create a batch file with something like the following — for instance, for a web development profile called "Dev":

    "C:\My Programs\FF30\firefox.exe" -P Dev -no-remote

You should omit any non-Firefox command line switches in the .bat file commands (i.e. do not put in -osint -url "%1"). If you have never create a batch file, simply open a text file, type the appropriate command(s) and save. Then rename the file extension from .txt to .bat.

Depending on OS, the steps you want to take differ from here.

Windows XP

Navigate to My Computer and select the Tools -> Folder Options -> File Types tab. You need to change 4 file type associations.

  • Firefox HTML Document
  • Firefox URL
  • URL: HyperText Transfer Protocol
  • URL: HyperText Transfer Protocol with Privacy

To be clear, to create a link only for actual .html files, just the first item needs to edited. The Firefox URL (.url) is a separate type of file and the remaining two items are for opening external links in programs such as Outlook (e.g. you wish to click a link in your email and have your .bat file handle that link).

For each of these, you will need to select the Advanced button, then Edit the default "open" action. Under the field marked "Application used to perform action:", paste the path to your .bat file e.g.

"C:\Documents and Settings\UserName\Desktop\Firefox.bat" "%1"

Make sure to use double quotes as above. Press OK, OK to finalize your changes.

You should, of course, copy the original entry in the field "just in case" and set it aside in case you want to reverse your changes at a later time. The basic form should be:

"C:\Path\To\Browser\firefox.exe" -osint -url "%1"

Please be aware that while changing all four options should not cause issues generally, the way any one program interprets a URL link or HTML page could be affected. Regarding comments by @Odys, there were no issues with links in Outlook Express 6, but extensive testing of other programs for linking issues has not be done.

Windows 7

Select any file ending in .html, right-click and select Properties -> General tab -> Change button. From the "Open with" menu, click the Browse button and from the Selection dialog, find your batch file and click the Open button.

Note that this can be done from

Control Panel\Programs\Default Programs\Set Associations

as well.

Note, however, that if you attempt to change the protocols for links (HTTP and HTTPS respectively) at the bottom of this list (after file associations), there is no option to Browse for a program. This means that for Windows 7, you cannot associate links (e.g. in a mail client) with particular profile. It might be possible to change this somehow with registry editing, but this hasn't been tested.

In any case, you have now created a link between the .html file extension and your executable .bat that opens Firefox under a specific profile.

Notes

  • You may have to install a copy of Firefox outside the Progams Files or Programs Files (x86) folders (similar to the example .bat file command) to avoid permission issues in both XP and Windows 7.

  • Don't forget that to automatically log in to a profile, you will need to enable that option in the Firefox Profile Manage window (firefox.exe -P or -ProfileManager).

  • Since Firefox uses whatever profile was last active when starting, you will likely want to create links to other .bat files to different profiles (e.g. to switch back to default from "Dev", etc.)

  • Remember that every profile contains data about add-ons, themes, etc. so you will likely have to select these when creating new profiles (this is especially important to remember if you use an addon to switch profiles.)

Links

Firefox Command Line Options are here. I noticed you have a small -p switch and its now officially a big -P for current versions (30.0+) of Firefox. I would check the other switches as well for proper syntax and support.