If you're going to support gvfs-open and gnome-open to solve #2 in situations where xdg-utils hasn't been installed and $BROWSER is unset, then I suggest adding the following two things to your fallback chain:
kioclient exec <URL> (KDE's equivalent to gvfs-open)
x-www-browser <URL> (This should go at the end of the fallback chain. On Debian-family systems (eg. Ubuntu, Mint), it invokes whatever browser is configured as default at the system-wide level and, as it's maintained by the package manager, it's guaranteed to be present and valid as long as at least one browser is installed... even if that means falling bact to lynx or links in a terminal.)
Also, if you want to be a little bit smarter in mixed installations, check whether the XDG_CURRENT_DESKTOP environment variable says KDE to determine whether kioclient exec <URL> should come before or after the g... ones in the precedence order.
If you're going to support
gvfs-openandgnome-opento solve #2 in situations wherexdg-utilshasn't been installed and$BROWSERis unset, then I suggest adding the following two things to your fallback chain:kioclient exec <URL>(KDE's equivalent togvfs-open)x-www-browser <URL>(This should go at the end of the fallback chain. On Debian-family systems (eg. Ubuntu, Mint), it invokes whatever browser is configured as default at the system-wide level and, as it's maintained by the package manager, it's guaranteed to be present and valid as long as at least one browser is installed... even if that means falling bact tolynxorlinksin a terminal.)Also, if you want to be a little bit smarter in mixed installations, check whether the
XDG_CURRENT_DESKTOPenvironment variable saysKDEto determine whetherkioclient exec <URL>should come before or after theg...ones in the precedence order.