Default browser not used from within Snap?

We’ve got user reports, that Snap version of our app opens links in Firefox instead of the default browser (Chrome in their case). It should be done using xdg-open in the Electron app.

Is it known?

Kind regards,

JonasT

1 Like

I guess the first thing to try would be to get the user to run xdg-open http://some-website in a terminal, and see what browser gets launched. If that also opens Firefox, then it sounds like Chrome is not actually set as the default handler.

If that does start Chrome, then there must be something different about the way snap userd invokes xdg-open compared to running it from the terminal.

Thank you, James. Unfortunately this was reported through one-way channel, so we cannot reach back to the user :frowning:

Hello guys,
we are receiving more reports of this issue now. Are you able to repro with Skype Snap by any chance?

Kind regards,

JonasT

I’ve got one more report, where the user tried the suggested, but xdg-open ran Chrome for him, while snap ran Firefox…

1 Like

I’m in this exact situation: xdg-open http://some-website opens Chrome, but when I click in a link in the Skype snap, it is opened in Firefox , with a new profile if there are no Firefox windows open.

I’m on Ubuntu 16.04 with Unity and using this version of snap:

snap    2.35
snapd   2.35
series  16
ubuntu  16.04
kernel  4.15.0-33-generic

And this revision of the skype snap:

installed: 8.28.0.41 (51) 148MB classic

3 Likes

Not directed related to the topic, but I got a crash while testing the snap: http://paste.ubuntu.com/p/RBhmR4fr6k/

I use google chrome as my default, and with it running, clicking on a link in a snap causes a totally new chrome to start up, somehow running with HOME=/home/john/snap/skype/common. I don’t think it’s using userd’s xdg-open at all. It’s only working because it’s a classic (ie unconfined) snap.

1 Like

Skype got updated to 8.31.0.92 and this is still a problem. Is there any Skype maintainer around here?

As mentioned further up in the thread, does the xdg-open shell script invoke the expected browser for you? I see the string “xdg-open” in the Skype binary, so it seems likely that this is how it is starting the browser.

Skype is a classic snap, so it likely isn’t using snap userd’s “xdg-open proxy”, but the end result would be the same if it is just invoking xdg-open.

Yes, xdg-open http://some-website opens my default browser when used from the command line, so I’m not really sure what is happening here.

Is there a solution for this problem? xdg-open works correctly, opens firefox, but clicking links from snaps (slack, yakyak) opens firefox BUT in different profile.
Edit: oh wow, 1 year later… so this must be surely solved somehow.

This is still a problem with the Skype snap as well: I always get Firefox with a new profile window when clicking on links.

Same issue here, using Ubuntu Budgie with Slack installed via Snap. I haven’t tested any other snaps but any links from Slack open in a vanilla Firefox window with a different profile than my usual Firefox.

This issue is still present with the Skype snap. I have come across the same problem when playing with Etcher. It is built with Electron and the program needs the --browser-support plug to run. If you package the program with strict confinement then it uses the correct browser, however, with --classic it looks for Firefox.

xdg-open opens the default browser in both cases but the links accessed via the program seek Firefox. Uninstalling Firefox triggers a prompt (first time you click a link in Skype) asking for confirmation that Google Chrome is indeed the default browser (although it has already been set). When you confirm that it is, Chrome tries to open a window and crashes:

[  350.192536] chrome[4402]: segfault at 1 ip 00007f67b86af628 sp 00007ffc2dce47c8 error 6 in libc-2.31.so[7f67b8546000+178000]
[  350.192560] Code: fe 7f 6c 17 c0 c5 fe 7f 74 17 a0 c5 fe 7f 7c 17 80 c5 f8 77 c3 c5 fe 6f 06 c5 fe 6f 4e 20 c5 fe 6f 54 16 e0 c5 fe 6f 5c 16 c0 <c5> fe 7f 07 c5 fe 7f 4f 20 c5 fe 7f 54 17 e0 c5 fe 7f 5c 17 c0 c5

Is it possible that this behaviour is present for all snaps which use classic and --browser-support or are built with Electron?

1 Like

I’m experiencing the same issue with notable. links are openned in firefox when my default browser is brave.

executing xdg-open on my host open links properly in brave.

notable snap is using the classic confinment

Same for me. I’ve used Telegram snap and it opens all links in FF. Just reinstalled native telegram. Now I’ve installed Spotify and same here, links are opening in FF.

xdg-open useses Chrome.

Perhaps issue is because my current DE is KDE but I do have Gnome installed, but I have no idea what is default browser there, coz I don’t use Gnome. Perhaps Snap uses settings from gnome, not from current WM.

Can a root cause be pinpointed?

I guess that it’s due to the nature of snaps trying to sandbox apps, and due to that invoking xdg-open/similar with the wrong env vars, causing it to create a separate browser profile.

As this issue seems quite widespread, I hope we can work together to get this fixed!

2 Likes

I’m using Kubuntu 21.04 and what has helped me is to set default browser in KDE settings, instead of relying on Chrome’s setting of default browser.
Under System Settings > Applications > Default Applications > Web Browser
Now all links in snap apps are opening in Chrome.

I am using Kubuntu 21.04 and am having this same problem. I have my default browser set to Brave everywhere (system settings, xdg-settings get default-web-browser, xdg-settings get default-url-scheme-handler https and xdg-settings get default-url-scheme-handler http. When I click on a link from a Snap application, it opens Chrome.