I am currently working on a custom uri-scheme (protocol) in google chrome and require a method to automate some testing (and development) of this protocol purely from within the chrome browser.
For example. If a redirect/anchor link points to this example uri
testuri://thismessage/additionaldata
then I would like to to redirected back into JS somehow. I.e. with a call to say
function protocolMessage(data) { ... }
I have explored the use of 'navigator.registerProtocolHandler' but that requires the use of 'web+testuri', which isn't an option (unless someone knows of a setting that can be used to turn this off).
I have investigated using a chrome custom extension to capture the uri under webNavigation but it doesn't capture anything but http(s) schemes. And I cannot see any functions that would allow me to register a custom scheme directly either.
Further investigation led me to try calling out to a system application (using custom uri-schemes that call native executables) and this partly works but now i'm stuck on how to redirect that message back into the current page/tab's javascript.
I also had a look at NaCL (Pepper API's) but that doesn't seem to allow registration of custom schemes either.
I am hoping for a better solution than calling out and back into the browser, but if not can anyone shed any light on a good solid reusable solution?
Any ideas? Thanks in Advance
To my knowledge, no, sadly.
All Chrome APIs work with "supported schemes" and you can't add one.
web+custom:
is also an inflexible limitation.
If you have a system application, you can talk to it by either providing a WebSocket server in the application, or working with Native Messaging.
The problem with native messaging is that Chrome has to initiate the connection to a new instance of the Native host. So you'll need to be able to handle the native app being invoked separately for protocol handling and for messaging.