Adding a custom URL protocol involves making changes to the Windows registry using Regedit. Please note that editing the Windows registry can potentially cause issues with your system if not done correctly. Make sure to create a backup of the registry before proceeding and follow these steps carefully:

  1. Create the HTML File: Create the HTML file that you want to open with your custom URL protocol. For example, let's create a file named custom.html with some content.

  2. Create the Custom URL Protocol: Press Windows + R to open the Run dialog, type regedit, and hit Enter to open the Registry Editor.

  3. Navigate to the HKEY_CLASSES_ROOT Key: In the Registry Editor, navigate to the HKEY_CLASSES_ROOT key.

  4. Create a New Key: Right-click on HKEY_CLASSES_ROOT and select "New" > "Key." Name the new key with your custom URL protocol, such as mycustomprotocol.

  5. Set the Default Value for the Custom URL Protocol: Click on the newly created key (e.g., mycustomprotocol). In the right pane, right-click on the (Default) value and select "Modify." Set the value to a descriptive name for your protocol, like "My Custom Protocol."

  6. Create a New Key for Command: Right-click on the same key (e.g., mycustomprotocol) and create a new subkey named "shell" (if it doesn't already exist).

  7. Create a New Key for the Command's Action: Right-click on the "shell" key and create a new subkey named "open."

  8. Set the Default Value for the Command's Action: Click on the "open" key. In the right pane, right-click on the (Default) value and select "Modify." Set the value to the text you want to display for the action (e.g., "Open Custom URL").

  9. Create a New Key for the Command's Action Command: Right-click on the "open" key and create a new subkey named "command."

  10. Set the Default Value for the Command's Action Command: Click on the "command" key. In the right pane, right-click on the (Default) value and select "Modify." Set the value to the command you want to execute when the custom URL is opened.

    For example, to open the custom.html file using the default web browser, use the following value:

    arduino
    "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" "file:///C:/path/to/your/custom.html"

    Replace "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" with the path to your browser executable, and "file:///C:/path/to/your/custom.html" with the path to your custom.html file.

  11. Save and Exit: Close the Registry Editor.

Now, when you enter mycustomprotocol:// in a web browser's address bar or use it as a hyperlink, it should open the specified HTML file in your default web browser. Remember to test your custom URL protocol carefully, and be cautious when making changes to the Windows registry.

Have questions or queries?
Get in Touch