From 144c2f584fb776c309f63e5d0d3449b8272fb3f8 Mon Sep 17 00:00:00 2001 From: Matt Giuca Date: Thu, 14 Jun 2018 15:40:49 +1000 Subject: [PATCH] One possible approach to separate BeforeInstallPrompt from automatic prompt. --- index.html | 51 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 46 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index bc7dfbebe..ff544342f 100644 --- a/index.html +++ b/index.html @@ -414,16 +414,58 @@

Prior to presenting an automated install prompt, a user agent - MUST run the steps to notify that an install prompt is + MAY run the steps to notify that an install prompt is available, to give the site the opportunity to prevent the default action (which is to install the application). Alternatively, the user agent MAY run the steps to notify that an install prompt is available at any time, giving the site the opportunity to show a site-triggered install prompt without automatically showing - the prompt. + the prompt. And, the user agent MAY present an install prompt + at any time, without giving the site an opportunity to prevent it (in + this case, it is RECOMMENDED that the automated prompt be minimally + intrusive, since the site will have no control over when it shows).

+
+

+ The above gives user agents a number of alternatives for + controlling the prompting behaviour: +

+
    +
  1. Don't ever show an automated prompt; dispatch the + BeforeInstallPromptEvent, requiring the site to opt in to + showing a prompt. +
  2. +
  3. Show an automated prompt, and do not implement + BeforeInstallPromptEvent. The prompt is considered part of + the user agent's user interface, not under the control of the + developer (no different to any other affordance offered by a user + agent). +
  4. +
  5. Show an automated prompt, and independently, dispatch the + BeforeInstallPromptEvent (perhaps at different times or + under different circumstances). This is just a combination of the + previous two options. The automated prompt might look quite + different to the site-triggered prompt (e.g., being smaller or more + subtle). In this approach, using preventDefault on + the BeforeInstallPromptEvent would have no effect, since it + is independent of the automated install prompt. +
  6. +
  7. Dispatch the BeforeInstallPromptEvent, and if it is not + cancelled, show an automated prompt. In this approach, using + preventDefault + would stop the automatic prompt from appearing. User agents that + adopt this approach would need to show a second prompt if the + event's prompt() + method is called (otherwise, the site might show an "Install" + button that does nothing when clicked). +
  8. +
+

- In either case, when a user agent presents an install prompt, the end-user's choice is represented either "accepted" or "dismissed". These values are represented in the API of @@ -455,8 +497,7 @@

browsing context.
  • If mayShowPrompt is true, then the user agent MAY, - in parallel, request to present an install prompt - with event. + in parallel, present an install prompt.