Intent to Ship: More accurate offline capability detection for PWA sites before showing install prompt

259 views
Skip to first unread message

Makoto Shimazu

unread,
Feb 3, 2021, 8:35:26 PM2/3/21
to blink-dev, asam...@chromium.org, PJ McLachlan

Contact emails

asam...@chromium.orgshi...@chromium.orgpjmcl...@google.com

Explainer

None

Specification

https://w3c.github.io/manifest/#installability-signals

Summary

Test if the registered service worker can return a 200 response when it's offline by dispatching a fake fetch event to the service worker with simulating an offline environment. The install prompt will be shown only if the test passes.


Blink component

UI>Browser>WebAppInstalls

Search tags

installabilitypwaofflineservice worker

TAG review

n/a because this doesn't affect the spec.

TAG review status

Not applicable

Risks



Interoperability and Compatibility

N/A The spec says "How a user agent makes use of these installability signals to determine if a web application can be installed is left to implementers". This change is compatible with this guidance.



Gecko: No signal

Edge: No signal

WebKit: No signal

Web developers: No signals

Ergonomics

n/a



Activation

This will impact sites that already have manifest.json and a service worker but it's not offline capable. Those sites will need to cache and return a valid response in the offline environment to show the install prompt. In order to mitigate the risk of immediately losing the functionality, we will ship a warning message first to tell developers that the install prompt is going not to be shown in near future.



Security

n/a



Debuggability

DevTools shows a warning message in the Application tab and console once the new check fails.



Is this feature fully tested by web-platform-tests?

No

Tracking bug

https://crbug.com/965802

Sample links

Offline capable site: https://pwa-sample-cds.glitch.me/
Non-offline capable site: https://pwa-sample-cds-no-offline-support.glitch.me/


Link to entry on the Chrome Platform Status

https://www.chromestatus.com/feature/5723214099513344

This intent message was generated by Chrome Platform Status.

Masataka Yakura

unread,
Feb 4, 2021, 12:25:44 AM2/4/21
to blink-dev, Makoto Shimazu, asam...@chromium.org, PJ McLachlan
Does the change affect already-installed WebAPK apps with empty fetch handlers?

yo...@yoav.ws

unread,
Feb 4, 2021, 3:56:48 AM2/4/21
to blink-dev, Masataka Yakura, Makoto Shimazu, asam...@chromium.org, PJ McLachlan
Same question for already installed web apps in general.

Is this web exposed? Can pages detect if an install prompt was shown for them?

Yoav Weiss

unread,
Feb 4, 2021, 4:05:29 AM2/4/21
to blink-dev, Masataka Yakura, Makoto Shimazu, asam...@chromium.org, PJ McLachlan
On Thu, Feb 4, 2021 at 9:56 AM yo...@yoav.ws <yo...@yoav.ws> wrote:
Same question for already installed web apps in general.

Is this web exposed? Can pages detect if an install prompt was shown for them?

It was pointed out to me off thread that it is indeed web exposed: https://web.dev/customize-install/#beforeinstallprompt
 
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/b158d049-f594-44f6-b028-87cef1f33190n%40chromium.org.

Makoto Shimazu

unread,
Feb 4, 2021, 5:26:07 AM2/4/21
to Yoav Weiss, blink-dev, Masataka Yakura, Makoto Shimazu, asam...@chromium.org, PJ McLachlan


2021年2月4日(木) 18:05 Yoav Weiss <yo...@yoav.ws>:


On Thu, Feb 4, 2021 at 9:56 AM yo...@yoav.ws <yo...@yoav.ws> wrote:
Same question for already installed web apps in general.

Is this web exposed? Can pages detect if an install prompt was shown for them?

It was pointed out to me off thread that it is indeed web exposed: https://web.dev/customize-install/#beforeinstallprompt

Yes, you're right. Thanks for the link!
 
 

On Thursday, February 4, 2021 at 6:25:44 AM UTC+1 Masataka Yakura wrote:
Does the change affect already-installed WebAPK apps with empty fetch handlers?

Thanks for asking. 
No, it doesn't affect already-installed web apps. We change the check which runs before showing the install prompt, but there's no such check after an app is installed.

Yoav Weiss

unread,
Feb 4, 2021, 5:56:52 AM2/4/21
to Makoto Shimazu, blink-dev, Masataka Yakura, asam...@chromium.org, PJ McLachlan
Thanks! This sounds like an important improvement that will increase the user experience reliability when installing web apps. 

I thought if this would benefit from e.g. WPTs that can enforce a consistent bar across different implementations, but it seems like the spec explicitly says that such a bar shouldn't be enforced.

Given that, LGTM1

Daniel Bratell

unread,
Feb 4, 2021, 2:38:31 PM2/4/21
to Yoav Weiss, Makoto Shimazu, blink-dev, Masataka Yakura, asam...@chromium.org, PJ McLachlan

Chris Harrelson

unread,
Feb 4, 2021, 3:20:22 PM2/4/21
to Daniel Bratell, Yoav Weiss, Makoto Shimazu, blink-dev, Masataka Yakura, asam...@chromium.org, PJ McLachlan

Masataka Yakura

unread,
Feb 5, 2021, 12:16:02 AM2/5/21
to blink-dev, Makoto Shimazu, blink-dev, Masataka Yakura, asam...@chromium.org, PJ McLachlan, yo...@yoav.ws
On Thursday, February 4, 2021 at 7:26:07 PM UTC+9 Makoto Shimazu wrote:


2021年2月4日(木) 18:05 Yoav Weiss <yo...@yoav.ws>:


On Thu, Feb 4, 2021 at 9:56 AM yo...@yoav.ws <yo...@yoav.ws> wrote:
Same question for already installed web apps in general.

Is this web exposed? Can pages detect if an install prompt was shown for them?

It was pointed out to me off thread that it is indeed web exposed: https://web.dev/customize-install/#beforeinstallprompt

Yes, you're right. Thanks for the link!
 
 

On Thursday, February 4, 2021 at 6:25:44 AM UTC+1 Masataka Yakura wrote:
Does the change affect already-installed WebAPK apps with empty fetch handlers?

Thanks for asking. 
No, it doesn't affect already-installed web apps. We change the check which runs before showing the install prompt, but there's no such check after an app is installed.

Thanks! Good to hear that it won't affect existing users.

susanna yuen

unread,
Feb 5, 2021, 9:00:43 PM2/5/21
to Masataka Yakura, blink-dev, Makoto Shimazu, asam...@chromium.org, PJ McLachlan, yo...@yoav.ws

Masataka Yakura <masatak...@gmail.com> 于 2021年2月5日周五 13:16写道:

Mike West

unread,
Feb 8, 2021, 6:34:39 AM2/8/21
to Daniel Bratell, Yoav Weiss, Makoto Shimazu, blink-dev, Masataka Yakura, asam...@chromium.org, PJ McLachlan

Ashley Gullen

unread,
Feb 12, 2021, 11:48:51 AM2/12/21
to Mike West, Daniel Bratell, Yoav Weiss, Makoto Shimazu, blink-dev, Masataka Yakura, asam...@chromium.org, PJ McLachlan
For the record this breaks the installability check for PWAs that respond with a redirect to a resource that responds with 200 OK. Since the redirect itself is not a 200 OK, and it appears the new installability check does not follow redirects, it fails the check. This does actually work fine offline if the Response.redirect is generated in the SW and the redirect URL is served from SW cache, but with this change this type of PWA no longer counts as installable. I first mentioned this here: https://bugs.chromium.org/p/chromium/issues/detail?id=965802#c62


Reply all
Reply to author
Forward
0 new messages