Is it possible to make an in-app button that triggers the PWA “Add to Home Screen” install banner?

Chrome(or any PWA supporting browser) triggers the beforeinstallprompt event for Web app install banner, which you can catch and re-trigger in more appropriate time when you think user wont miss it/convinced about adding your site to home page. Starting Chrome version 68, catching beforeinstallprompt and handling the install prompt programmatically is mandatory and no banners … Read more

Best practices for detecting offline state in a service worker

navigator.onLine and the related events can be useful when you want to update your UI to indicate that you’re offline and, for instance, only show content that exists in a cache. But I’d avoid writing service worker logic that relies on checking navigator.onLine. Instead, attempt to make a fetch() unconditionally, and if it fails, provide … Read more

Service worker is caching files but fetch event is never fired

After looking at your gist and your question, I think your issue is with scoping. From what I’ve determined with service workers(at least with static files), the service worker only has a maximum scope of the directory it is in. That is to say, it can’t load files/requests/responses that are pulled from a location at … Read more

What features do Progressive Web Apps have vs. native apps and vice-versa, on Android [closed]

TL;DR – As of Feb 2017, Progressive Web Apps are a sufficiently powerful platform that Twitter has moved all of their mobile web traffic to a React PWA. As of August 2016, Progressive Web Apps actually offer more hardware access than commonly thought. Here’s a screenshot of whatwebcando.today from my Chrome 52 stable on Android: … Read more

Can service workers cache POST requests?

You can’t cache POST requests using the Cache API. See https://w3c.github.io/ServiceWorker/#cache-put (point 4). There’s a related discussion in the spec repository: https://github.com/slightlyoff/ServiceWorker/issues/693 An interesting solution is the one presented in the ServiceWorker Cookbook: https://serviceworke.rs/request-deferrer.html Basically, the solution serializes requests to IndexedDB.

What is the storage limit for a service worker?

Update Jan 15 2018 The StorageManager interface of Storage API is becoming a standard for all storage related api queries. As mentioned by @miguel-lattuada, the estimate API would provide an estimate of the storage used a web app the available storage. Also, note the QuotaExceededError exception which would help us in handling error scenarios. eg … Read more

Service worker JavaScript update frequency (every 24 hours?)

Note: As of Firefox 57, and Chrome 68, as well as the versions of Safari and Edge that support service workers, the default behavior has changed to account for the updated service worker specification. In those browsers, HTTP cache directives will, by default, be ignored when checking the service worker script for updates. The description … Read more