My requirement is to run custom protocol handler using firefox in linux systems.

I have successfully added protocol handler in Ubuntu by creating myapp.desktop file in /usr/share/applications. The content is something like this.

[Desktop Entry]
Name=myapp
Comment= My Custom protocol handler
Exec=/path/to/my/application %U
Icon=myicon
Terminal=0
Type=Application
X-MultipleArgs=True
MimeType=x-scheme-handler/myapp
Encoding=UTF-8
Categories=Network;Application;

After that I run update-desktop-database. All set and I was able to type myapp:// in firefox browser of Ubuntu or in Fedora and myapp got invoked.

While the same procedure does not work in Centos or Opensuse. I tried the following things in centos and opensuse but it did not work.

gconftool-2 -t string -s /desktop/gnome/url-handlers/myapp/command "/path/to/my/app %U"
gconftool-2 -s /desktop/gnome/url-handlers/myapp/needs_terminal false -t bool
gconftool-2 -t bool -s /desktop/gnome/url-handlers/myapp/enabled true

Please help in making the protocol handler work in centos and opensuse. I am using centos-6.2 and opensuse 11.2

Thanks in advance.

有帮助吗?

解决方案

I figured out the the reason. Running gconftool does add the url handler. I was running those command as part of rpm post script which takes root privileges. Hence url handler did not get registered with user. Once running manually as user, firefox could call myapp when I type myapp:// in the browser.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top