11

I have a html test page with the link:

<a href="customprotocol:information-from-browser">Link.</a>

If I open this in Safari and click on the link, the handling app (a custom app) opens correctly.

But when I open this page in Google Chrome and click on the link, the app does not open.

The clicked link fires a GET request, but it's status is cancelled. And the whole request is shown in red in the Network Inspector.

chrome network tab

I thought maybe Chrome does this for security reasons, and blocks unregistered custom URL schemes by default. To get around this, I added a bit of javascript to the html page (from this question):

window.location.assign("customprotocol:");

which pops up a dialog asking if the user wants to associate customprotocol: with the app.

Even after pressing OK and thus setting the customprotocol: handler recognized by chrome, the link still does not launch the app. It remains a cancelled request.

Why is this? How do I get this to work in Google Chrome?


Note 1: AFAIK, all my software are updated to the latest versions.

Note 2: The cancelled request has no response and preview information. Under timing, the request shows as stalled.

Community
  • 1
  • 1
Capstone
  • 2,254
  • 2
  • 20
  • 39

3 Answers3

3

In general, it seems that protocols are actually passed onto the OS if chrome doesn't recognize them. So you may have just confused your chrome.

Look how steam://browsemedia works for Valve's game manager Steam. Debug that link and I bet it actually gets the same results that you got. Try, mailto:me it successfully opens my email client. Obviously the browser doesn't need to send and actual request, So I would ignore all your request analyzing. I tested this, the "Stalled" status is CORRECT.

I think you need to reset whatever customhandler settings you have got in chrome. I think it may be interfering with letting the OS deal with it.

Worthy7
  • 1,455
  • 15
  • 28
0

On Chrome (desktop) you can register custom protocols through the registerProtocolHandler api.

https://developer.mozilla.org/en-US/docs/Web/API/Navigator/registerProtocolHandler

Miguel Garcia
  • 1,029
  • 5
  • 14
  • 2
    This does not work. The registration popup appears (as before). But the link still says cancelled request (as before). – Capstone Apr 18 '17 at 13:45
  • your custom scheme _must_ begin with `web+`, and this may only be called from a secured https context, did you ensure this was the case? your example requires `web+customprotocol` for it to work. – mseddon May 23 '22 at 14:13
0

I was experiencing this same issue and had to fix the registry definition since I had bungled it.

The key bits I messed up:

  1. you MUST include the "URL Protocol" REG_SZ with no value
  2. command is a key whose (Default) REG_SZ is the path to the executable you want launched

References:

https://support.shotgunsoftware.com/hc/en-us/articles/219031308-Launching-applications-using-custom-browser-protocols

https://learn.microsoft.com/en-us/windows/win32/search/-search-3x-wds-ph-install-registration#installing-and-registering-a-protocol-handler

rguilbault
  • 553
  • 1
  • 5
  • 17