11

When I am using xdg-open to open a link in Chromium, it just results in a new Chromium window with only the new tab page, with nothing else.

For example, xdg-open 'https://askubuntu.com' will just open a new Chromium window and won't open up AskUbuntu.

It just seems that the URL isn't being passed to Chromium, as invoking Chromium directly does work and opens the desired page: chromium-browser 'https://askubuntu.com' works.

Obviously, Chromium is the default browser.

Where could the problem be, and how can I fix that? It is especially annoying when some programs use xdg-open to open a link and you can't go to the page you want, or even see what was opened.

1
  • Although this question is for Chromium, this might work for Firefox if it is the same issue.
    – Léo Lam
    Oct 24, 2014 at 10:29

1 Answer 1

16

The issue is indeed that xdg-open does not pass the requested URL to Chromium, so instead of running chromium-browser url-here, it is executing chromium-browser which just opens a new window.

After searching on the Internet, I found out that xdg-open uses some "config" files located in /usr/share/applications.

/usr/share/applications/chromium-browser.desktop seemed to be correct, as it is configured to pass the URL to Chromium correctly:

$ grep Exec /usr/share/applications/chromium-browser.desktop
Exec=chromium-browser %U
...

So what was wrong? It turns out that there's another location which xdg-open uses and that has priority over /usr/share/applications.

$ grep Exec ~/.local/share/applications/chromium-browser.desktop
Exec=/usr/lib/chromium-browser/chromium-browser --use-system-title-bar --ppapi-flash-path=/usr/lib/pepflashplugin-installer/libpepflashplayer.so --ppapi-flash-version=14.0.0.125

I have no idea as to why there's another chromium-browser.desktop, but note that this Exec line does not pass the URL; it is missing the %U. So I simply appended %U to this line. This instantly fixed all issues with xdg-open and Chromium.

5
  • Incredible! I've been beating my head against a brick wall for weeks on this one, barely found this answer. Same thing happens with the google-chrome package. How did you figure it out? Oct 15, 2015 at 1:14
  • 1
    I had this issue for a long time too, and I only found the cause when I happened to read about .desktop application files -- I remembered the issues with Chromium and decided to check the files, and that's how I got it fixed.
    – Léo Lam
    Oct 15, 2015 at 18:43
  • 1
    Ultimately, I think that the issue was caused by pepperflash, although I'm not sure. Need to look at the package file list or install script to be sure.
    – Léo Lam
    Oct 15, 2015 at 18:44
  • Thanks, worked for google-chrome by updating ~/.local/share/applications/google-chrome.desktop
    – Vlad
    Nov 5, 2015 at 10:09
  • Moved chrome-related files from /.local/share/applications and it started working instantly! Thanks!
    – Íhor Mé
    Feb 26, 2017 at 19:03

You must log in to answer this question.

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