Why doesn’t a clicked custom-protocol link in an Apps Script web app reach its Windows handler? #214799
Replies: 3 comments
Possible cause: Chrome's sandbox restrictions on external protocol navigationI suspect the Apps Script iframe sandbox may be involved, although I would not consider this confirmed without inspecting the actual sandbox flags and Chrome's diagnostic output. Google Apps Script HTML Service runs web app content inside a sandboxed iframe. Google documents several permitted sandbox attributes, including Chromium also implements explicit security checks for external-protocol navigation originating from sandboxed browsing contexts. 1. How to investigate the actual causeI would start with the following checks:
Also check There is no general-purpose JavaScript API that exposes the exact reason for every rejected external-protocol navigation. However, browser diagnostics and Chromium's implementation can help identify the relevant security check. 2. Why
|
|
This may actually be related to Chrome's iframe sandbox restrictions rather than the registered URI handler itself. Google Apps Script HTML Service runs web apps inside sandboxed iframes. Chrome has additional restrictions on launching external protocols from sandboxed frames, even when the link click has valid user activation. A few things worth investigating:
Unfortunately, Apps Script controls its own iframe sandbox attributes, so developers cannot simply add arbitrary permissions to the iframe. Relevant documentation:
I'd be interested to know whether the same URI link works when hosted outside Apps Script. That would help narrow down the source of the restriction. |
|
Adding a few things that weren't covered above: 1. The exact console message. When Chromium's sandbox check blocks it, the console says:
It's logged in the inner frame's console, so in DevTools switch the context dropdown (top-left of the Console, usually 2. 3. A 2-minute local repro to rule it in or out. Save this as
|
Uh oh!
There was an error while loading. Please reload this page.
🏷️ Discussion Type
Question
Body
On Windows, a Chrome tab displaying an Apps Script HTML Service web app renders a link to a registered custom URI scheme. Clicking the visible link is expected to prompt for or start the registered local app.
What I observed
Illustrative link shape (placeholder only):
<a href="example-report://run?payload=sample" target="_top">Open the report app</a>.Is there a documented way to tell which check stopped the launch, or a supported pattern for invoking a registered Windows handler from an Apps Script web app? I’m not looking to weaken browser or enterprise security settings.
Related browser report: https://issues.chromium.org/issues/593529883
Drafted with ChatGPT; the exact model version was not available in the interface.
Guidelines
All reactions