/home/techb158/ileadtechnology.com/public
Edit: /home/techb158/ileadtechnology.com/public/sw.js (772B)
const CACHE_NAME = 'em-ANK-HAR-Cache-v1';
const URLS_TO_CACHE = [
"/public/offline",
];
self.addEventListener("install", function(event) {
event.waitUntil(
caches.open(CACHE_NAME).then(function(cache) {
return cache.addAll(URLS_TO_CACHE);
})
);
});
self.addEventListener("fetch", function(event) {
event.respondWith(
fetch(event.request).catch(function() {
return caches.match(event.request).then(function(response) {
if (response) {
return response;
} else if (event.request.headers.get("accept").includes("text/html")) {
return caches.match("/offline");
}
});
})
);
});