Skip to content Skip to sidebar Skip to footer

How To Load Website Offline From Base Url Using Service Workers And Cache Api?

When you visit this web site https://bugs.stringmanolo.ga/index.html, while navigating around the main.js file is calling a method from ff.js file to cache a good amount of the res

Solution 1:

In your cache array list add a root entry. That's it.

var CACHELIST = [
    "/",
    // rest of resource list
];

self.addEventListener("install", function (event) {
    console.log("Installing the Service Worker!");
    caches.open(CACHENAME)
        .then(cache => {
            cache.addAll(CACHELIST);
        });
});

Post a Comment for "How To Load Website Offline From Base Url Using Service Workers And Cache Api?"