Browser plugin which can register its own protocol

2019-08-15 05:29发布

问题:

I need to implement a browser plugin which can register its own protocol (like someprotocol://someurl) and be able to handle calls to this protocol (like user clicking on 'someprotocol' link calls function inside my plugin). As far as I understand, Skype does something similar, except I need to handle links within page context and not in a separate app. Any advice on how this can be done? Can this be done without installing my own plugin, with the help of flash/java?

回答1:

Things are going to be slightly more complicated than you think.

You're going to have to create an entire application, not just a browser plugin (that plugin can be part of your application). The reason I consider it to be a complete application is that you're going to need to modify registry settings on the client machine to register your custom URL handler.

Here's an MSDN article describing exactly what you have to do to register the custom URL handler on a Windows client:

Registering an Application to a URL Protocol