我见过:
http://www..。 ftp://blah.blah..。 文件:/ / blah.blah…… 不真实:/ / blah.blah…… mailto: / / blah.blah……
你看到http和类似调用的第一部分是什么?
我可以自己登记吗?
我见过:
http://www..。 ftp://blah.blah..。 文件:/ / blah.blah…… 不真实:/ / blah.blah…… mailto: / / blah.blah……
你看到http和类似调用的第一部分是什么?
我可以自己登记吗?
当前回答
You don't really have to do any registering as such. I've seen many programs, like emule, create their own protocol specificier (that's what I think it's called). After that, you basically just have to set some values in the registry as to what program handles that protocol. I'm not sure if there's any official registry of protocol specifiers. There isn't really much to stop you from creating your own protocol specifier for your own application if you want people to open your app from their browser.
其他回答
You don't really have to do any registering as such. I've seen many programs, like emule, create their own protocol specificier (that's what I think it's called). After that, you basically just have to set some values in the registry as to what program handles that protocol. I'm not sure if there's any official registry of protocol specifiers. There isn't really much to stop you from creating your own protocol specifier for your own application if you want people to open your app from their browser.
第一部分被称为协议,是的,你可以注册自己的协议。在Windows上(我假设你是在使用c#标签——抱歉Mono的粉丝们),它是通过注册表完成的。
打开记事本,将下面的代码粘贴进去。将“YourApp”更改为应用程序的名称。
保存到YourApp。通过在资源管理器中单击它来注册并执行它。
就是这样!
REGEDIT4
[HKEY_CLASSES_ROOT\YourApp]
@="URL:YourApp Protocol"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\YourApp\DefaultIcon]
@="\"C:\\Program Files\\YourApp\\YourApp.exe\""
[HKEY_CLASSES_ROOT\YourApp\shell]
[HKEY_CLASSES_ROOT\YourApp\shell\open]
[HKEY_CLASSES_ROOT\YourApp\shell\open\command]
@="\"C:\\Program Files\\YourApp\\YourApp.exe\" \"%1\" \"%2\" \"%3\" \"%4\" \"%5\" \"%6\" \"%7\" \"%8\" \"%9\""
下面是已注册URI方案的列表。每一个都有一个RFC——一个定义它的文档,这几乎是一个标准。RFC告诉新应用程序(如浏览器、ftp客户端等)的开发人员他们需要支持什么。如果你需要一个新的基本级别协议,你可以使用一个未注册的协议。其他答案告诉你怎么做。请记住,您可以使用现有的协议做很多事情,从而获得它们的现有实现。
带有HTTP://,FTP://等的部分称为URI方案
您可以通过注册中心注册自己的网站。
HKEY_CLASSES_ROOT/
your-protocol-name/
(Default) "URL:your-protocol-name Protocol"
URL Protocol ""
shell/
open/
command/
(Default) PathToExecutable
来源:https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml http://msdn.microsoft.com/en-us/library/aa767914 (v = vs.85) . aspx