Service Worker Options - Forum

Forum Navigation
You need to log in to create posts and topics.

Service Worker Options

I want my app to be available even when the user doesn't have any connection, and, when connected the app is updated, automatically or when the user manually reloads the app page.

In this scenario, what would be the best option to use with Service Worker among the existing ones?

Uploaded files:
  • You need to login to have access to uploads.

Hi @eduardovolpi, note that all service workers come from pwabuilder.com. I'm not sure how do they work in detail as the information they provide is quite limited. I have copy-pasted the description they offer for each one:

Offline page

This simple but elegant solution pulls a file from your web server called "offline.html" (make sure that file is actually there) and serves the file whenever a network connection can not be made.

Offline copy of pages

A solution that expands the offline capabilities of your app. A copy of each pages is stored in the cache as your visitors view them. This allows a visitor to load any previously viewed page while they are offline.

Offline copy with Backup offline page

A copy of each pages is stored in the cache as your visitors view them. This allows a visitor to load any previously viewed page while they are offline. This then adds the "offline page" that allows you to customize the message and experience if the app is offline, and the page is not in the cache.

Cache-first network

Use this service worker to pre-cache content.

Advanced caching

Use this service worker to improve the performance of your app, and make it work offline. The advanced caching service worker allows you to configure files and routes that are cached in different manners (pre-cache, server first, cache first, etc.).

Background Sync

Use this service worker to implement background sync for your app, ensuring that crucial requests made while the app is offline can be replayed when the user comes back online.

Serving Cached media

Use this service worker to play back audio and video to the user that has been cached for offline play.

Vadim, CDY@44 and EduardoVolpi have reacted to this post.
VadimCDY@44EduardoVolpi

Thank you @luishp , This gives me a better sense of what each option does.