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?

N.N.
  • 18,589
jfoucher
  • 24,444

6 Answers6

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
David Foerster
  • 36,890
  • 56
  • 97
  • 151
Pouyan
  • 361
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)

David Foerster
  • 36,890
  • 56
  • 97
  • 151
JCE
  • 81
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?

Lekensteyn
  • 178,446
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

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!

Digger
  • 176
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.

N.N.
  • 18,589