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() #578

Closed
mgiuca opened this issue May 10, 2017 · 1 comment · Fixed by #836
Closed

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

mgiuca opened this issue May 10, 2017 · 1 comment · Fixed by #836

Comments

@mgiuca
Copy link
Collaborator

mgiuca commented May 10, 2017

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 Install prompts: Allow manual prompting but not automatic prompting #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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant