[w3c/manifest] Add Manifest option for specifying browser app picker behavior (#764)

**Problem:** When a user clicks a link in a web page, it may be able to be handled by many different apps installed on the system. For example, clicking a link to reddit may be able to handled by:
1. The default browser in which the link was clicked
2. A reddit PWA that's installed (via a [launch event handler](https://github.com/WICG/sw-launch/blob/master/explainer.md))
3. The reddit Android app that's installed
4. A native app that handles reddit links

Browsers/OS's can implement UI which allows users to choose which app they want to use to handle to link (an "app picker"). PWA's may want to give different _hints_ to the browser about whether or not they can handle different links into their app, e.g.
-Some PWAs may want the browser to always show the app picker for link clicks into their PWA, to give the user the option of which app to open the link with. 
-Some PWAs may want the browser to always directly open link clicks in their app without showing the app picker. This is analogous to the behavior of [Android App Links](https://developer.android.com/training/app-links).
-Some PWAs may never want the browser to open certain links in their app. For example, Facebook may have an app, but they are also an authentication provider and may not want redirects to login links to be opened in the app (e.g. https://www.facebook.com/v3.2/dialog/oauth)

The app picker needs to show up before the launch event is fired so apps need a way to define these behaviors up-front.

**Proposal:** Add a manifest entry to specify these _hints_. Note that the browser is always free to override the hint.
`link_capturing_preference: "never"` - tell the browser that this app never handles link clicks into itself and the app picker shouldn't list the app as an option. The link click should never launch the PWA or fire a launch event.
`link_capturing_preference: "ask_user"` - tell the browser that the app does handle link clicks, but the browser should ask the user whether to handle the link first. This would be the default setting if not specified.
`link_capturing_preference: "always"` - tell the browser that the app prefers to handle link clicks without the user being shown an app picker. Browsers are still free to override this and show a dialog if they choose.

By default these options apply to all link clicks in the scope of the app. However apps could also define  these options for more narrow scopes inside itself: 
```
link_capturing_preference: [
  { "/" : "always" },
  { "/v5.5/dialog/oauth" : "never" }]
```

/cc @benfredwells @dominickng @fallaciousreasoning 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/manifest/issues/764

Received on Thursday, 2 May 2019 06:01:45 UTC