Are there methods to register a custom protocol with a google chrome extension like you can in firefox :
const kSIMPLEURI_CONTRACTID = "@mozilla.org/network/simple-uri;1";
const kIOSERVICE_CONTRACTID = "@mozilla.org/network/io-service;1";
const nsISupports = Components.interfaces.nsISupports;
const nsIIOService = Components.interfaces.nsIIOService;
const nsIProtocolHandler = Components.interfaces.nsIProtocolHandler;
const nsIURI = Components.interfaces.nsIURI;
I want the protocol:
xyz:
Not xyz://
Is this possible?
Best Answer
Chrome does not offer a way to set custom handlers for the
xyz:
scheme.There are some ways to emulate the behavior though:
xyz:...
.Use the
webRequest
API to intercept and redirect all requests from the default search provider to a custom URL. I'm using this method for catching wildcard search keywords, but it can also be used for supporting fake schemes. Unfortunately, the extension would be quite specific to the user's search settings, because it would do something like this:in both cases, you won't see
xyz:whatever
in the omnibox, though.navigator.registerProtocolHandler
should be the best way to register axyz:
handler. Unfortunately, it is quite limited at the moment. Custom protocols must be prefixed withweb+
. Also take a look at the list of open bugs for this API.