23

When Firefox is set as my default browser, any links cliked in another application open a new blank Firefox window, not a new tab or a new window with the page I want.

Is that a problem with the configuration of firefox, of "Preferred Applications" or what else?

The firefox executable script works fine, because doing firefox http://example.com in a console window does the correct thing. Is there a way I can edit the "preferred applications" manually?

8
  • Which version of Ubuntu are you running? Do you have more than one version of Firefox installed?
    – wojox
    May 7, 2011 at 16:06
  • That may be because firefox needs some special commandline argument to open link in new window. Try entering firefox --help in console to see. May 7, 2011 at 16:29
  • I'm running 11.04, but the problem could have been there before. I wanted to switch from chrome to firefox when version 4 came out. Gave up because of this issue. Only firefox 4 installed
    – jfoucher
    May 7, 2011 at 19:32
  • 1
    @barafu man firefox tells me firefox [OPTIONS] [url] but firefox --help gives the following error: /usr/lib/firefox-4.0.1/firefox-bin: error while loading shared libraries: libxul.so: cannot open shared object file: No such file or directory
    – jfoucher
    May 7, 2011 at 19:36
  • @jfoucher: I get that error as well, to make that error dissappear, add the library path: LD_LIBRARY_PATH=/usr/lib/firefox-4.0.1 firefox --help. What application are you experiencing issues with?
    – Lekensteyn
    May 7, 2011 at 20:03

6 Answers 6

36

I have found an answer.

$ xdg-settings get default-web-browser
firefox-mozilla-build.desktop

and then find where it is:

$ locate firefox-mozilla-build.desktop
/home/user/.local/share/applications/firefox-mozilla-build.desktop

Open it

vi /home/user/.local/share/applications/firefox-mozilla-build.desktop

and then change

Exec=firefox

to:

Exec=firefox %u
5
  • I was having problems because I use Firefox Developer Edition which is installed manually, including the creation of the .desktop file. This solves it.
    – ecc
    Sep 7, 2015 at 12:29
  • Had the exact same error with Chromium. Had to add the %u to the file ~/.local/share/applications/chromium-browser.desktop
    – birgersp
    Jun 20, 2016 at 6:34
  • 3
    Still relevant in 2018, Firefox Developer edition Quantum (64-bit)
    – wassimans
    Apr 6, 2018 at 10:12
  • 3
    xdg-settings get default-web-browser returns firefox-esr.desktop, that file content is correct; problem still happening.
    – m0skit0
    Jun 25, 2018 at 10:21
  • 1
    Beautiful, solved my problem with Chrome too.
    – HaipengSu
    Sep 6, 2018 at 15:08
8

Symptom : Click on a link in an appli like Thunderbird or LibreOffice opens a blank tab or page in Firefox.

Solution : Find the file (or equivalent) userapp-firefox-S2GY5X.desktop in folder /home/myself/.local/share/applications and replace

Exec=/usr/bin/firefox %f

with

Exec=/usr/bin/firefox %u  

(u = URL briefly)

4

You were not really helpful with "any application", but I've tried to find an application in which I could open an URL. I've tested the "Get Help Online..." option from the Help menu, which confirmed that URLs are opened in new windows.

Using my imagination, I watched new commands coming by executing:

while : ;do ps x -o args | head -6 | tail -3; sleep .5;echo '___'; done

After executing this, I quickly pressed the previously mentioned "Get Help Online..." menu option. As the command appears, I escape from the command by pressing Ctrl + C (interrupt). The command is a python call. The relevant file for opening the URL is:

/usr/share/launchpad-integration/launchpadintegration/urls.py

By analyzing that file, I conclude that a new Firefox window is forced if the application to be run is firefox %s (determined by gconftool-2). To change this behavior, set the key /desktop/gnome/url-handlers/http/command to firefox %u.

To do so, open a terminal and execute:

gconftool-2 --set /desktop/gnome/url-handlers/http/command --type string 'firefox %u'

For a GUI way, see How do I use the gconf editor?

4
  • thanks for all your help. When I say any application, that's because I haven't found an application in which links clicked open properly in firefox. I tried Hotot, Gwibber, ubuntu one, empathy, skype, and others. You solution sounded good but did not solve the problem unfortunately. I think my problem is the same as this question askubuntu.com/q/24051/38 only reversed...
    – jfoucher
    May 7, 2011 at 21:49
  • This one is also quite similar: askubuntu.com/q/18418/38 I tried all the steps listed without any success
    – jfoucher
    May 7, 2011 at 21:50
  • $ ps x -o ags gives error: unknown user-defined format specifier "ags"
    – tsbertalan
    Mar 21, 2016 at 13:33
  • @tsbertalan It should have been "args", I have corrected it now.
    – Lekensteyn
    Mar 25, 2016 at 11:30
2

Firefox user here.

None of the above worked for me. I already had the '%u' in my configuration file.

I notice, though, that whenever I clicked on a hyperlink inside my terminal, Firefox would pop up me an error message would telling me I've already opened the browser instead of just opening a new tab. This made me think a new separate window from my current browser was being launched.

But I got a wrong impression. This is because is I have two versions of Firefox (beta and ESR). If you don't set up your regular browser as the default one any click on hyperlinks would launch your other version of Firefox, and if you aren't paying attention, it would seem like you are trying to open a new window from your regular browser and not a new tab.

TL;DR
If you use two versions of the same browser, make sure your regular one is set as default one

0

I have FF 6.0 and have Ubuntu 11.04. I go to FF > Edit> Preferences > Tab (which is a tab in this window) and you have a bunch of choices as to how your tabs should react.

0

Debian Wheezy, with an Xfce4 desktop. Firefox ESR version 52.8.0 (32-bit):

I had a similar, but not identical problem. Clicking an Internet hyperlink in LibreOffice opened a new Firefox window, even when Firefox was already running in an already-existing window. In addition, said new Firefox window would open two tabs, one with a URL of "www.%u.com", and one with the desired URL.

To stop this undesirable behavior, I opened the /home/your user/.local/share/xfce4/helpers/firefox-esr file with a text editor and changed the X-XFCE-CommandsWithParameter=firefox-esr %u "%s" line therein to X-XFCE-CommandsWithParameter=firefox-esr "%s"

Now, I get the desired behavior (i.e. the desired URL opens as a new tab in the already present Firefox window...

IHTHS!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .