Why this matters to me
Native apps on every operating system can be opened by a link scheme, by a file type, by a share, and can hand a result back to whatever opened them. The web has gained most of the first half of that over ten years: registerProtocolHandler, then share_target, file_handlers, protocol_handlers and launch_handler in the manifest.
What it has not gained is the second half. In every one of these routes the app that is opened receives a string, a form or some file handles, and the app that started it receives nothing back. Web Intents, in 2011, had a reply. So does the picker on Port Authority, which hands each side one end of a MessageChannel. The routes below are the ones the operating system knows about, and none of them can carry a port.
I have written about this for a long time: What happened to Web Intents, The web that never was and Detecting if a URL scheme can be handled. This page is the same argument, with checks.
1. A page cannot ask whether a link will go anywhere
Nothing tells a page whether a scheme has a handler
What is missing
A page that shows a web+follow: or web+census: link cannot find out whether pressing it will open anything. Chrome once had navigator.isProtocolHandlerRegistered. It was removed from the HTML Standard and then from Chrome.
How I know
- The custom scheme handlers section of the HTML Standard defines
registerProtocolHandlerandunregisterProtocolHandlerand nothing that reads the state. - The removal from Chrome was announced on blink-dev. One reason given was that a page could test a long list of schemes to learn which sites a person uses.
Why I want it
A link that does nothing when pressed is worse than no link. So sites do not use custom schemes, and send everyone to an https: address on one provider instead.
What it would enable
- A Follow link that opens the person's own Mastodon or ActivityPub server, and shows a sign-up choice when they have none.
- Links for payments, calendars or maps that go to the app the person chose, with a sensible page when there is none.
What you have to do today
Guess. Press the link and watch whether the page loses focus or navigates. My 2022 post goes through the ways to guess, and all of them are heuristics. An answer only on a user gesture, one scheme at a time, would deal with the fingerprinting concern.
2. A handler is given a string, not a channel
Nothing can be sent back to the app that opened a link, a file or a share
What is missing
A protocol handler gets the link in its address. A file handler gets file handles on launchQueue. A share target gets a form. None of them gets a way to answer. The page that opened the link cannot be given a result, and cannot be given a MessagePort to keep talking.
First register this site as the web+census: handler on the census page. This opens a web+census: link in a new window, and the handler page reports whether it has a window.opener.
How I know
LaunchParamsin the Web App Launch Handler API hastargetURLandfiles. The check above lists what it has in your browser.- Web Share Target delivers a share as a navigation to the target's address, with a GET or a POST.
Why I want it
The useful integrations are round trips. Pick a photo and get it back edited. Ask for a signature and get the signed document. Choose a payment app and get a confirmation. Today each of these needs both apps to agree on a server, a redirect address or a shared storage area.
What it would enable
- An editor on one origin opened on a file by another app, which gets the edited file back when the editor is done.
- The picker on Port Authority as part of the operating system: a link or a share that ends with a port between the two apps.
What you have to do today
Open the other app in a window you control and pass ports by window.postMessage, which is what the port patterns on Port Authority do. That works between two pages. It does not work for anything the operating system starts.
3. An app cannot see which of its handlers are on
The manifest declares handlers, and nothing reads them back
What is missing
An installed app declares protocol_handlers, file_handlers and share_target. The browser may accept them, ignore some on a platform that does not support them, or let the person turn them off. The app cannot find out which.
Why I want it
An app that cannot see whether it handles .txt files cannot tell the person how to open one with it, or offer a different way when it does not.
What you have to do today
Check display-mode to learn whether the page is installed, and assume the handlers came with it.
5. Another origin's service worker is out of reach
A page can only talk to its own origin's service worker
What is missing
A service worker is the one part of a web app that can run with no window open. It is the natural place to receive a request from another app. But a page can only reach the service workers of its own origin.
How I know
- getRegistration in the Service Workers specification rejects with a SecurityError for an address on another origin.
What you have to do today
Put a frame from the other origin on the page and carry a port through it. Joining two sites' service workers does this, with the time limits and rejoining it needs.
6. Every launch opens a window
There is no launch event in the service worker
What is missing
A link, a file or a share sent to an installed app opens a window, or focuses one. launch_handler chooses which, and every choice involves a window. The service worker is never asked first, so an app cannot take a request and decide that nothing needs to be shown.
How I know
- The
client_modevalues in the Web App Launch Handler API are auto, navigate-new, navigate-existing and focus-existing. - A launch event for service workers was proposed in WICG/sw-launch and has not shipped.
What it would enable
An app that adds a shared link to a reading list, or saves a file to a sync folder, without a window flashing up.
7. Handlers only exist after an install a page cannot offer
Install is the gate, and the way to open it differs by browser
What is missing
Everything in the manifest only takes effect once the app is installed. A page can offer to install itself only in browsers with the non-standard beforeinstallprompt, or with navigator.install where that is being tried.
Why I want it
registerProtocolHandler works from an ordinary tab. The newer handlers do not. A site that wants to handle files has to persuade the person to install it first, through a control the site cannot point to.
8. Links into an app on another origin
An app's scope is one origin, and its links cannot be checked
What is missing
An installed app covers addresses under its scope on one origin. scope_extensions lets it take in other origins that agree to it via /.well-known/web-app-origin-association, so that ordinary https: links open the app. Even when both origins publish the agreement (as the Notes app and this Hub now do), a page cannot check whether the browser accepted it or whether a given link will open in an app or a tab.
How I know
- The scope_extensions explainer, and my older post on deep web app linking.
What I am not asking for
- A way for any page to list the schemes, files or shares a person's apps handle. One question at a time, on a user gesture, is enough.
- Handlers that take effect without the person agreeing. Registering and installing should both stay something the person says yes to.
- A reply channel that the receiving app has to accept. If it never answers, the sender should be told the other end is gone, which is a gap of its own on Port Authority.
How this list was made
Each item comes from building the integration census. The checks are in probes.js. I have run them in Chromium on Linux only, in a tab and not installed. Routes that need an installed app, such as a file opened from the operating system, I have not yet tested on each platform.
If something here is wrong, already fixed, or already proposed somewhere I did not find, please open an issue.