Closed dfabulich closed 1 year ago
@dfabulich I like this. It's a valid way of making sure that n.install
can't immediately start spamming installation prompts. It also gives some time for the UA to perform the required installability checks. I'll consider it, I think it can provide good feedback to devs when the loading is in this grey-area before all checks have been completed.
@dfabulich The promise will resolve if the app is installed, and will reject otherwise. One of the added errors is a InsufficientEngagementError
, as you proposed. This will allow developers to know if the minimum engagement threshold has been met beforehand. Thanks for the feedback.
Chromium browsers currently gate the
onbeforeinstallprompt
event behind an engagement heuristic.https://web.dev/install-criteria/
For a same-domain installation, if the user clicks on a button that calls
navigator.install()
before the 30-second timer is up, thennavigator.install()
needs to fail with an error in that case.Currently the explainer documents three possible types of errors:
I think we need one more, which I'm suggesting could be called
InsufficientEngagementError
. In that case, the installation hasn't been blocked by permissions policy; you just need the user to engage with the site a little bit more.