MicrosoftEdge / MSEdgeExplainers

Home for explainer documents originated by the Microsoft Edge team
Creative Commons Attribution 4.0 International
1.31k stars 216 forks source link

[Web Install] How do related applications impact these APIs? #790

Open mhochk opened 7 months ago

mhochk commented 7 months ago

The explainer calls out

When the related_applications and prefer_related_applications key/values are present in the manifest, the UA should try to handoff the install to the prefered catalog.

What should be the return value of install() in this case? And should future calls to getInstalledApps be expected to include information about this app?

My assumption would be that it is expected to behave like any other case, returning the manifest_id and appropriately including the manifest_id in future getInstalledApps calls, but it would be good to confirm.

amandabaker commented 7 months ago

This is a great callout. I don't know if it would be guaranteed that the browser would be notified of the user either installing the app or rejecting installation, so I'm not sure how we would resolve/reject the promise in response to the install() request if we wait for some user action to happen.

One lazy option is to add another response type to indicate that the user was prompted to install a native app instead of the PWA, but that doesn't address the usability issue of the store not knowing whether to show an "Install" or "Open" button.

diekus commented 7 months ago

If I think about related_applications and try to understand its context, the options were to have an organically installed (yet generally lower quality "go" or "lite" version) from the browser or to somehow redirect the install invocation to a store to get the better full-blown experience.

The cross-origin install scenario was not a thing. A concern of mine is that on certain platforms the web installation will always redirect to the native store, but at the same time the data seems to indicate only 2% of manifest use the related_apps field which eases my concern.

Going back to the call out, there is no way that a web site will know anything about the app installation once/if it is being handed off to a native store. But, as far as the API is concerned (and I am very open to objections if this is not an acceptable outcome), once the installation is handed off to the store the promise should resolve. If there is any issue in this handoff then it should reject.

Do you agree here? I do not want a web site to be able to know if a native store installed or not an app, and if the field is present in the manifest I think there is an explicit intention from the developer to prefer the alternative app distribution channel.

mhochk commented 7 months ago

I definitely agree that related_applications should be respected at install time.

From a privacy perspective I'm not overly concerned about a Store site being able to tell that a native app is installed. The Store has already been granted permission (by the WebApp developer and the user) to know if the WebApp is installed, and the manifest openly declares that it prefers a particular native app.

From an implementation perspective, integrating with native apps would be a complicated best-effort that I don't expect would have satisfactory solutions on all (any?) platforms.

Given that, I lean towards treating this just like an error/cancellation as far as the caller is concerned, and if it proves to be a real-world problem it can always be revisited.