Download the cdn file and save it to Service Worker

Is it possible to load a site using cdn bootstrap javasctipt and css file and save these files in Service Worker for offline? I would like to know how to download a file from the Internet and save it for offline use. I really appreciate every tip or article.

+5
source share
1 answer

The Work Services Cache API supports caching of all CDN resources, and you can use the cache API , which provides a mechanism to store pairs of Request / Response objects that are cached as part of the ServiceWorker life cycle.

Infact sw-precache and sw-toolbox are the most popular Service worker caching libraries, which provide common caching patterns and an expressive approach for Runtime Caching and Precaching for static resources.

The additional methods described in the offline-cookbook provide a reliable, stand-alone experience with reasonable reserves.

+6
source

All Articles