As you all know Browsers has a way to register custom protocols, which would enable websites to register themselves as possible handlers.
For Example, this handler allows mailto links in the browser to direct the user to MyMailServer.com, inserting the email address in the URL link.
navigator.registerProtocolHandler(“mailto”, “https://www.mymailserver.com/?uri=%s”, “MyMailService”);
Note, for security reasons, you guessed right, you have to be on the same domain as the URI for registering the protocol handler. In addition there is no way to detect if the custom protocol is registered. This is where my problem started.
At my product, we have a desktop software that does register a custom protocol, say “rs-custom” with all the browsers. Its works just fine when the software is installed and the protocols are registered. But as we progressed well, we wanted to handle negative cases when the custom protocol was not registered ( which means software was not installed ).
Browsing around, we soon learnt that none of the browsers support isProtocolRegistered() Navigator API as a security risk. Damn, time for figuring out work arounds for every damn browser. It took me a couple of days to figure out solutions for IE and FireFox, but Chrome was surprisingly the long poll.
Try it out @ http://rajeshsegu.com/fun/code/browser/detect.html