JavaScript - Protocol handlers registered but, reading fails from windows registry

1.3k Views Asked by At

I did following:

1) In Windows 7: Under registry: HKEY_CLASSES_ROOT\PROTOCOLS\Handler I have my custom protocol calls: stackoverflow (copied similar way in registry like other protocols mailto or ftp etc)

Followed

2) Open in IE the sample: http://jsfiddle.net/L528u/

<a href="stackoverflow:talking" id="link1">CLICK IT</a>
<button onclick="alert(document.getElementById('link1').protocolLong);">CHECK - IF - Protocol available or not</button>

3) when click the button from IE to detect the protocol: stackoverflow it fails

I get always alert box: "Unknown protocol" but when i try to detect protocols like: ftp, mailto it works

<a href="ftp:talking" id="link1">CLICK IT</a>
<button onclick="alert(document.getElementById('link1').protocolLong);">CHECK - IF - Protocol available or not</button>

Question: Can anyone please tell me what is missing in registry entry for to activate the new protocol? "stackoverflow" (where ftp, mailto works but not stackoverflow)

2

There are 2 best solutions below

4
EricLaw On BEST ANSWER

Internet Explorer only surfaces built-in protocols via protocolLong. There isn't anything you can put in the registry to allow web-based detection of Application Protocols.

0
PhistucK On

Internet Explorer 10 (and later) on Windows 8 (and later, note that Windows 7 is not included! See msLaunchUri not available in IE11) implements a new method with a success and an error callback parameters that can assist in protocol handler invoking situations - navigator.msLaunchUri(uri, successCallback, noHandlerCallback). For details, see http://msdn.microsoft.com/en-us/library/ie/jj154912(v=vs.85).aspx