Re: [w3c/ServiceWorker] `registerProtocolHandler` support triggering events in service worker instead of navigating to page (Issue #1665)

Here is my extended explanation.

### 1. PWA "protocol_handlers"
https://developer.chrome.com/articles/url-protocol-handler/
This is a declarative way. It is easy to use, but only for installed PWA. Non-PWA web and browser extensions can't use it.

### 2. Firefox extension's "protocol_handlers"
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/protocol_handlers
Similar to PWA, it is also a declarative way, but just for extensions. There is no background event for clicking a register link.

So both 1) and 2) are declarative ways, and are not general(universal) solution.

### My proposal
My proposal expands `registerProtocolHandler` and let service worker to handle the click event.

1. This is a programmatic solution. This approach is more flexible (than declarative way) and leaves it up to the developer to manage how it is handled. It is very similar to handle notification event in service worker. 
2. It can works for 1) installed PWA, 2) non PWA(general web), and 3) browser extensions (Chrome MV3 is service worker based, and Firefox now support event page).

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/issues/1665#issuecomment-1345153726
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/ServiceWorker/issues/1665/1345153726@github.com>

Received on Saturday, 10 December 2022 06:22:24 UTC