我见过:

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.

其他回答

打开记事本,将下面的代码粘贴进去。将“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客户端等)的开发人员他们需要支持什么。如果你需要一个新的基本级别协议,你可以使用一个未注册的协议。其他答案告诉你怎么做。请记住,您可以使用现有的协议做很多事情,从而获得它们的现有实现。

这叫做协议。唯一阻止你制定自己的协议的是:

编写某种类型的浏览器或用户代理来理解该协议,包括URL形式和实际数据格式 编写一个能够理解该协议的服务器 最好有一个协议规范,这样浏览器和服务器就可以继续一起工作。

Windows使#1变得非常简单,在很多情况下这就是你真正需要的。即:

将应用程序注册到URL协议

带有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

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.