Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a way to find out the result of the install prompt without prompt() #2

Open
mgiuca opened this issue Apr 1, 2020 · 0 comments
Labels
install-prompt https://wicg.github.io/manifest-incubations/index.html#installation-prompts

Comments

@mgiuca
Copy link
Member

mgiuca commented Apr 1, 2020

Moved from w3c/manifest#578:

There are currently two ways to find out whether the user installed your app or not:

  • The appinstalled event. (Only gives you a positive answer, doesn't tell you if they cancelled the install prompt.)
  • The beforeinstallprompt event: call prompt(). The result of prompt tells you whether the user accepted.

Chrome's implementation has an additional userChoice attribute (on the BeforeInstallPromptEvent) that lets you passively detect prompt acceptance/denial without calling prompt().

There's one problem with using prompt() instead of a passive userChoice: it may produce slightly different prompting behaviour.

As the spec currently stands, calling prompt() in the beforeinstallprompt event handler is a no-op; it doesn't change the behaviour at all (which defaults to prompting), and therefore, prompt() in the event handler is equivalent to userChoice. However, #576 calls for a change to allow user agents to not prompt by default, but show a prompt if prompt() is called. This means developers using prompt() as a substitute for userChoice would suddenly get non-default behaviour. There would be no way for a site to passively detect prompt acceptance/denial without inadvertently forcing the prompt to be shown.

Some possible approaches here (presented without opinion):

  • "We aren't going to action #576, and therefore prompt() is just as good as userChoice".
  • "This use case is not important enough; if you care enough about collecting data, then you can decide for yourself when the prompt should be shown and not rely on the default behaviour. Or use appinstalled to collect data."
  • "We do want a way to let developers passively collect this data. Let's add Chrome's userChoice."
  • "We do want a way to let developers passively collect this data. But userChoice (being an attribute promise) is weird; let's design something else."

Thoughts?

@phoglenix phoglenix added the install-prompt https://wicg.github.io/manifest-incubations/index.html#installation-prompts label Sep 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
install-prompt https://wicg.github.io/manifest-incubations/index.html#installation-prompts
Projects
None yet
Development

No branches or pull requests

2 participants