How to check for a protocol existence without executing it using Angular?

  angular, browser, javascript, registry, windows

Use case:

In order to install a custom scheme (AKA custom URL protocol) & execute a custom binary file, I need to verify its existence first in the windows registry.

Available solutions:

https://github.com/vireshshah/custom-protocol-check

https://github.com/ismailhabib/custom-protocol-detection

checkProtocolExistence() {
    customProtocolCheck(
      // uri: Custom protocol url to check for
      'custom-protocol://',
      () => {
        // failCb: Callback function which gets called when custom protocol not found.
        console.log('Protocol not found.');
      },
      () => {
        // successCb: Callback function which gets called when custom protocol is found.
        console.log('Protocol found and opened the file successfully.');
      },
      // timeout: (default: 2000). It waits for timeout unless it calls failCb.
      5000
    );
  }

Problem statement:

  • The proposed packages successfully verified the custom URL protocol existence, but in order to achieve the callback, it must be executed first.
  • After executing the custom URL protocol, a browser alert notification shows up.

![Untitled](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/0d1ee093-f722-4a6b-92ba-3bd1501d4be3/Untitled.png)

  • Which in my case, I don’t want the user to see the alert notification (just for the verification).

Questions?

  • Is there a possible way to verify a custom protocol’s existence in the Windows registry without executing it?
  • Is there a possible way to prevent the alert notification after executing the custom protocol?
  • Is there a possible way to execute a Powershell command and read its callback from my web app?

Dev environment

  • Angular v7.2.16
  • Node v12.16.2
  • NPM v6.9.0

Source: Windows Questions

LEAVE A COMMENT