Qt5 open in browser (QDesktopServices::openUrl()) does't work

This code:

QDesktopServices::openUrl("http://ubuntu.com");

Doesn’t work if application is running in sandboxed snap. It simply doesn’t open web browser. If I run the app directly with no jail it works fine.

Here is the snapcraft.yml

name: huggle
version: "3.3.0"
summary: Diff browser for MediaWiki based websites intended to deal with vandalism
description: Diff browser for MediaWiki based websites intended to deal with vandalism
confinement: strict
epoch: 0
grade: stable

apps:
  huggle:
    command: desktop-launch huggle
    plugs:
        - unity7
        - x11
        - network
        - home
        - opengl
        - pulseaudio
        - browser-support

parts:
  application:
    prepare: ./build/prepare_snap.sh
    plugin: cmake
    configflags:
      - -DQT5_BUILD=true
      - -DPYTHON_BUILD=true
      - -DLINUX_SNAP=true
      - -DHUGGLE_EXT=true
    source: huggle/
    stage-packages:
      - libpython3.5
      - libqt5gui5
      - libqt5core5a
      - libqt5webkit5
      - libqt5concurrent5
      - libqt5quickparticles5
      - libqt5widgets5
      - libqt5declarative5
      - libqt5quickwidgets5
      - libqt5network5
      - libqt5multimediaquick-p5
      - libqt5multimediawidgets5
    build-packages:
      - libpython3-dev
      - libgtk2.0-0
      - libdrm-dev
      - libegl1-mesa-dev
      - qtbase5-dev
      - libgl1-mesa-dev
      - libglu1-mesa-dev
      - libqt5opengl5-dev
      - libwayland-dev
      - libx11-dev
      - qtmultimedia5-dev
      - libqt5webkit5-dev
    after: [desktop-qt5]

Do you have the snapd-xdg-open deb installed on the host ?

No,

Do I need to add this package to snapcraft file so that it’s installed on every host?

No, only on the host, not in the snap (the function is soon being included in the snapd package so you don’t need this anymore)

I don’t understand, so what do I need to do to make this feature work on users computers? Installing this on “host” as in computer where I build snap package only fix it for that very system, but it doesn’t fix it for users of my program.

Packaging this thing with snap doesn’t work either. So you are trying to say there is no fix? Just wait?

well, or tell your users to install snapd-xdg-open in the package description or so … but yes, if you want it out of the box you have to wait until the merge below goes into a release (it is already in the master tree of snapd)

https://github.com/snapcore/snapd/pull/3260

the whole thing has been discussed at length in:

Hi… after 2 years it seams that this is still an issue… did you guys find a solution?