You are here

Running different versions of Firefox portable and command line URL support

13 posts / 0 new
Last post
kanu
Offline
Last seen: 3 years 7 months ago
Joined: 2017-10-03 02:48
Running different versions of Firefox portable and command line URL support

If Firefox portable is closed and I open a cmd.exe window (or run a batch file) with something like this: FirefoxPortable.exe www.mozilla.com
there won't be any problem.

If I have a Firefox portable window opened and try to run a Firefox Nightly portable window it will reply with: "another instance of Firefox is already running".
Ok. If I edit the FirefoxPortable.ini of the Nightly edition and set AllowMultipleInstances=true it will allow me to run the browser but no URL will open through command line on that browser, complaining that: "Firefox is already running, but is not responding".
This happens on current Firefox too.

So, running two different Firefox editions can be achieved with AllowMultipleInstances=true but this disables any command line support for opening URLs.

I've been trying different things about it for some weeks as the "-no-remote" parameter (on AdditionalParameters=) that I've seen suggested, but looks like this doesn't affect the problem.

Any suggestions?
Thanks.

John T. Haller
John T. Haller's picture
Offline
Last seen: 4 hours 22 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
You Can't

When multiple versions of Firefox are run with -no-remote, you can't launch them a second time from the command line. This switch is not designed for production use, it was made for testing by developers.

Sometimes, the impossible can become possible, if you're awesome!

kanu
Offline
Last seen: 3 years 7 months ago
Joined: 2017-10-03 02:48
Ok. Thanks.

Ok. Thanks.

kanu
Offline
Last seen: 3 years 7 months ago
Joined: 2017-10-03 02:48
Also this

BTW, even with only one instance sometimes it spits the "Another instance of Firefox is already running" when using command line URL input; in these cases it's the first of a batch (is like the FirefoxPortable.exe process reacts late for the first one, and then it keeps up). With and without the "-url" Firefox parameter and with and without safe mode.
Maybe something is askew in your code.

Edit: I can now produce the problem at will. Put these lines on a batch file in the same folder as Firefox Portable:

firefoxportable.exe wiki.mozilla.org
timeout 2
firefoxportable.exe www.mozilla.com
C:\(path_to_Firefox)\Firefox\FirefoxPortable.exe wiki.mozilla.org
timeout 2
C:\(path_to_Firefox)\Firefox\FirefoxPortable.exe www.mozilla.com

The first two webs will open without any trouble. The other two will get the "Another instance" error and do nothing else.

kanu
Offline
Last seen: 3 years 7 months ago
Joined: 2017-10-03 02:48
Not a single word about this?

Not a single word about this?

John T. Haller
John T. Haller's picture
Offline
Last seen: 4 hours 22 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Works Fine

With a fresh install of Firefox Portable and placing that exact set of commands in a BAT (adjusting the path of course) it works without issue. Keep in mind, if you're using multiple instances of Firefox, it won't work.

Sometimes, the impossible can become possible, if you're awesome!

kanu
Offline
Last seen: 3 years 7 months ago
Joined: 2017-10-03 02:48
Not really

Because the browser was closed. Open the browser first. Then run the script.

Sorry that I put the lines without a start first. Add "start" (and a space after, no quotes) at the beginning of any line with an exe. Try again.
You'll see almost always the four webs won't open and FirefoxPortable.exe will complain with "Another instance of Firefox is already running".

Tried with used Firefox and fresh new one (both without FirefoxPortable.ini), on two computers.

John T. Haller
John T. Haller's picture
Offline
Last seen: 4 hours 22 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Slower

I'd suggest starting them with more time between them. It's likely you're running it from a drive that takes a moment to start up the second instance of the FFP launcher then pass it off to firefox.exe which then starts up, realizes it's already running, then hands it off. And an antivirus is checking out these EXEs as they start up slowing them down further. If that process takes too long and you try to start a third instance of firefox.exe while the second one is still trying to pass a URL to the first one, it'll have issues. Starting multiple URLs one after another from a batch file is likely to trigger this especially when run from an external drive. I was running this from my internal SSD which is why I likely had no issue.

Sometimes, the impossible can become possible, if you're awesome!

kanu
Offline
Last seen: 3 years 7 months ago
Joined: 2017-10-03 02:48
??

If the problem were the drive it would matter otherwise, when the browser isn't running.
Anyway, tested on the same conditions but instead over a 1GB RAMdisk. Same results.

And by the way: Clean boot. No antivirus or Windows Defender. No Indexing service or Cortana at all. No shadow copy service.
No traces of other Firefoxes, ie.: No "Mozilla" folder in "Appdata\Local", "Appdata\LocalLow" or "Appdata\Roaming". Also, neither in registry "HKLM\Software" or "HKCU\Software".

Don't know what's happening here.

kanu
Offline
Last seen: 3 years 7 months ago
Joined: 2017-10-03 02:48
??

Tested on a third computer. Window 10 v.1709 (the others are v.1607) with an 850 Pro SSD. All of them are core i7.
Used Firefox 57.0.1 and a fresh clean 57.0.1. Same conditions, same issue.
Tried also with an ESR 52.5.0.

Sorry for spamming but I have to get something clear out of this and results are getting too consistent to ignore.

John T. Haller
John T. Haller's picture
Offline
Last seen: 4 hours 22 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Try This

First, make sure all instances of Firefox are closed.

Second, start FirefoxPortable.exe and wait for the browser to come up.

Third, run this BAT from the same directory as FirefoxPortable.exe:

FirefoxPortable.exe "http://wiki.mozilla.org/"
timeout 10
FirefoxPortable.exe "http://www.mozilla.com/"
timeout 10
FirefoxPortable.exe "http://wiki.mozilla.org/"
timeout 10
FirefoxPortable.exe "http://www.mozilla.com/"
timeout 10
FirefoxPortable.exe "http://wiki.mozilla.org/"
timeout 10
FirefoxPortable.exe "http://www.mozilla.com/"
timeout 10
FirefoxPortable.exe "http://wiki.mozilla.org/"

This works without issue on my system and I end up with 7 open tabs with those URLs.

Sometimes, the impossible can become possible, if you're awesome!

kanu
Offline
Last seen: 3 years 7 months ago
Joined: 2017-10-03 02:48
Solution

For anyone having this problem the solution is very simple:
1. Add a FirefoxPortable.ini (copy the one from Other\Source) to the main folder of FirefoxPortable.
2. Open it with a text editor and change the line "DisableIntelligentStart=false" to "DisableIntelligentStart=true". No quotes.
3. Save. Close all instances of Firefox and reopen.
Warning: This will probably generate some unpredictable consequences if the Firefox folder changes. Set it to "false" again so the launcher can update the new profile path; or manually edit the path in the Data\Settings\FirefoxPortableSettings.ini file.

Now when repeating ten times this:
C:\Path_To_Firefox\FirefoxPortable.exe wiki.mozilla.org
C:\Path_To_Firefox\FirefoxPortable.exe www.mozilla.com
the browser won't even bat an eyelid. Even without time delays.

Note: The problem reappears only when no path to Firefox is indicated (full path) but that's no obstacle even in portable batch scripts ("%~dp0").

PatPeter
Offline
Last seen: 2 years 4 months ago
Joined: 2010-09-20 15:32
BrowserRouter Solution

As a solution to this, what I did was I installed BrowserRouter: https://github.com/slater1/BrowseRouter

And then I added browser definitions for my default browser alongside my portable browser.

[browsers]
ff = C:\Program Files\Mozilla Firefox\firefox.exe
ffportablenightly = "P:\PortableApps\FirefoxPortableNightly\App\Firefox64\firefox.exe" -appDir "P:\PortableApps\FirefoxPortableNightly\App\Firefox64" -profile "P:\PortableApps\FirefoxPortableNightly\Data\profile" -new-tab {url}

You can use this to define your portable browser as your primary browser, which will default to your local browser if your portable browser isn't available. That, or you can specify which URLs you want to open in your portable browser.

Log in or register to post comments