8

Firefox is my default browser but I have to run Chrome to be able to use PWAs (progressive web apps). when I click links in the PWA they always open a Chrome window. I've been playing with appending an ff: to URLs and then having xdg-open handle the URL with Firefox but no luck so far. I read over the many xdg-open articles but I can't seem to get it to work properly. this seems like the cleanest way to go about it, though.

I realize I would need to write an extension to append every URL on the page with ff:. I'm on KDE Neon but I think this is applicable here.

Sources already used fruitlessly:

Fabby
  • 34,259
kinghat
  • 183

1 Answers1

1

so I'll try to help with making urls like ff:whatever to be opened in firefox. First, firefox does not know how to interpret ff: mime type, so we need to write a simple script that will remove ff: from the URL and pass the rest to firefox:

#!/bin/bash
firefox $(echo $1 | sed 's/ff://')

Place this script somewhere (I'll refer to it later as /path/to/script) and don't forget to make it executable with chmod +x /path/to/script. Next we need to create a .desktop file that will handle ff: mime and call this script. Good place for this file would be in ~/.local/share/applications/. You can give it any name

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Terminal=false
Name=OpenInFirefox
Comment=Open link in Firefox
Categories=Application;Network;
MimeType=x-scheme-handler/ff;
Exec=/path/to/script %u

Don't forget to replace /path/to/script with path to the script created before.

That's it. Now run sudo update-desktop-database and all links that start with ff: should open in firefox.