Search code examples
javascriptinternet-explorerbrowsermicrosoft-edgeurl-protocol

Detecting custom url protocol handler using javascript in windows 10 Edge Browser


In our web application we need to find out if a Custom URL Protocol Handler is registered or not in windows 10 machine using javascript with Windows 10 EDGE Browser.

If the Custom URL Protocol Handler is not registered in the windows 10 machine we will ask the user to download our desktop standalone app. If registered we will start our desktop standalone app using the registered Custom URL Protocol Handler.

Since EDGE is a new browser the solutions provided by other users in the internet are not working.

Links I referred that are not working for me in EDGE browser:

https://gist.github.com/keyvanfatehi/f2f521c654bab106fdf9

Please help me out, Thank you


Solution

  • Maybe this workaround helps:

    Whenever you navigate to an unkown protocol with MS Edge, Windows asks the user about the app to handle this protocol. You could just navigate to your protocol and display a message with some information about what to do if the tool does not open. Something like this (sorry for the German screenshot):

    <div id="toolBox">
       	<p id="toolBoxText"></p>
    	<input type="button" id="toolButton" onclick="openTool()" value="Start tool" />
    </div>
    <script type="text/javascript">
        	   function openTool(){
        		   window.location = 'myprotocol://command/';
        		   document.getElementById("toolButton").value = "Try again";
        		   document.getElementById("toolBoxText").innerHTML = "Thank you for using our tool. If the tool did not open successfully, please first download and install the tool <a href='download/'>here</a> and then try again."
        	   }
    </script>

    enter image description here