MicrosoftEdge / MSEdgeExplainers

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

[Web Install] Launching already installed app #849

Open felipe-dialpad opened 3 months ago

felipe-dialpad commented 3 months ago

The Web Install explainer says that getInstalledRelatedApps can be used to check if the app is already installed, and in such case, hide the Install button.

However, if instead of hiding we would like to show a "Launch" button, it seems that this isn't a use case currently supported, but I think it is a very valuable one. You can achieve this with custom protocol handlers, but that is much more invasive and prone to errors. I think as part of this spec it would be nice to add an open() function to the returned object from getInstalledRelatedApps to allow it to be launched.

amandabaker commented 3 months ago

I don't see it mentioned in the explainer, but we've discussed using navigator.install() to open apps as well. This was intended to address the issue where a user installs the app from one source (browser UI or web store), and later tries to install it again from a different web store via navigator.install(). If the API rejected with an AbortError and didn't offer to open the already-installed app, then it would be both a bad look for the web store and an inconvenience for users.

Instead, we proposed handling this scenario by allowing the UA to request to open the app, resolving the promise if the user accepts, or rejecting if the user cancels. Then subsequent calls to getInstalledApps() could list the "newly installed" app so the store knew to show an "Open" button instead of an "Install" button. @diekus Do you remember if anyone had any pushback about this approach or should it be safe to include in the explainer?

That said, it wouldn't be intuitive to use navigator.install() to open an already-installed app, so it may make sense to add the navigator.open() you suggested which: