ubuntu 配置url地址重定向协议
參考網址:
http://blog.csdn.net/eroswang/article/details/1594795
http://hi.baidu.com/pluto632/item/5007737da31344326f29f666
http://msdn.microsoft.com/en-us/library/aa767914.aspx#prot_sec
http://msdn.microsoft.com/en-us/library/ie/aa767914(v=vs.85).aspx
http://kb.mozillazine.org/Register_protocol
http://superuser.com/questions/162092/how-can-i-register-a-custom-protocol-with-xdg
https://support.shotgunsoftware.com/entries/86754-How-to-launch-external-applications-using-custom-protocols-rock-instead-of-http-
針對ubuntu
1:
All Firefox versions (Requires certain Gnome libraries to be installed) In a terminal, type: gconftool-2 -s /desktop/gnome/url-handlers/foo/command '/path/to/app %s' --type String gconftool-2 -s /desktop/gnome/url-handlers/foo/enabled --type Boolean true Replace foo on both lines with the protocol you want to register and /path/to/app with the path to the application you want to run.以上如果不行,可以試試一下操作 gconftool-2 -t string -s /desktop/gnome/url-handlers/foo/command 'foo "%s"'
gconftool-2 -s /desktop/gnome/url-handlers/foo/needs_terminal false -t bool
gconftool-2 -s /desktop/gnome/url-handlers/foo/enabled true -t bool
2:
在firefox地址欄輸入about:config,出現如下界面
之后firefox version >3.5 執行一下操作
在preference name 下面,右鍵-》new,選擇不同的類型建立不同的值
主要是如下幾個值:
最后的testfile,要替換成你自己的協議。
并且要確保network.protocol-handler.expose-all 為true
?
3.
? 建立應用程序的桌面文件:/usr/share/applications/testfile.desktop (文件名稱應該要與協議名稱一樣)
? 內容如下:
[Desktop Entry] Encoding=UTF-8 Name=testfile Comment=testfile Exec=/home/ubuntu/workspace/test_file/Debug/test_file %u Terminal=false StartupNotify=true Type=Application Categories=Application;Internet; Name[en_US]=testfile? ?之后在?/etc/gconf/gconf.xml.defaults/%gconf-tree.xml文件中添加以下內容
x-cheme-handler/testfile=testfile.desktop application/x-testfile=testfile.desktop application/testfile=testfile.desktop? ? 然后在~/.local/share/applications/mimeapps.list文件中添加以下內容
[Default Applications] //這一行必須要有x-scheme-handler/testfile=testfile.desktop application/x-testfile=testfile.desktop application/testfile=testfile.desktop
4.
? ?之后在firefox地址欄中輸入testfile://就能彈出你想要打開的程序
轉載于:https://www.cnblogs.com/flyingdirt/p/3776903.html
總結
以上是生活随笔為你收集整理的ubuntu 配置url地址重定向协议的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 定制IE浏览器的尖兵利器 - BHO
- 下一篇: ubuntu服务器启动过程中重启卡死的问