Custom protocol in linux?

余生长醉 提交于 2019-11-28 20:37:48

In the ideal situation, this sort of thing is handled by the desktop environment (KDE, GNOME, XFCE), and Firefox respects those settings---it should do so on Ubuntu, Fedora, and OpenSUSE, at least. YMMV:

Integrating a new URIs Scheme Handler to GNOME and Firefox

Adding a protocol handler for firefox (KDE)

The manual way to doing it for firefox:

open firefox
type in about:config to location bar
add new string
name:  network.protocol-handler.app.myapp
value: /path/to/program

There's not going to be a single answer, because that will be happening at the X window manager level at best. In general, you're going to need to have some chunk of code you can put into your path, and associate the name with the protocol. Have a look at the about:config page, which is where the handlers are set up.

That's really all that Windows does too, it's just that stuff is in the registry.

This looks like a decent drescription for Firefox.

Can I associate a system-wide handler like in Windows? or does it need to be browser-dependent?

It has to be browser-dependent. There's no cross-browser way of associating URL handlers in Linux.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!