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 a 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). A picture of the profile manager with the correct option checked is here.
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 the ProfileSwitcher add-on below.)
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.
ProfileSwitcher -- An add-on to help verify which profile is currently active if you can't tell otherwise. Despite the comments regarding FF 29 compatibility, this does work with FF 30.0 as of version 1.6.2.
This is not a simple solution, this is nightmare. Also, it can't be applied to links inside Outlook for example. – Odys – 2014-07-06T10:32:33.557
Well, not a nightmare if it worked.:( I thought anything would be better than nothing (no solution since weeks searching around) ALAS it didn't work either. It just opens the selected profile FF window when we open a html file and DOESN'T actually open it in browser. Anything needed to be added Anaksunaman? BTW Any other Solution/way you can think of , please do let me know. Thanks – SuperUserMan – 2014-07-06T14:12:06.180
@SuperUserMan update question to address comments, etc. In short, you need to check the "Use the selected profile without asking at startup" option in the Profile Manager to suppress the dialog box. However, since Firefox will use the last profile used each time it starts, you will likely want links to other batch files to switch to different profiles for different activities. – Anaksunaman – 2014-07-08T10:24:50.600
As for other solutions, you could try something with AutoHotKey I suppose but I don't see what the benefit would be. Otherwise, if I had a set of known links (e.g. a list of gaming links) I might create links to .bat files (or similar) that levied the power of profiles and the Firefox -url switch to open tabs to specific pages at start up. But that's just me. As a rule, I don't allow old tabs to just (re)start up. – Anaksunaman – 2014-07-08T10:30:06.360
@Odys actually it can, at least to a degree, though admittedly behavior might be unpredictable depending on how a program interprets links. But I had no issues with basic links in Outlook Express 6. – Anaksunaman – 2014-07-08T10:40:15.497