You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue I came across occurs in Chrome and Safari, whereas works fine in Firefox(most of the time). fetch() request for events.json always resolves even in offline mode. I have added an OnlineState counter as you can see in the below code. Chrome keeps triggering this Online state even in offline mode (as can be observed from the added number of Online Requests) whereas Safari most of the time does not trigger this resolved promise at all (as can be observed from the not increasing number of Online Request). Safari only triggers Resolve function when I shift+refresh the page to delete cache and only then on my following regular refresh I can see the Resolve function triggered. So I think this is a browser file caching related problem. However, how come a failed fetch event, trigger a function inside a resolved promise in Chrome? And how come a supposedly successful fetch event not resolve in Safari?
//Added this variable before the serviceWorker fetch eventListener
var onlineRequest = 0;
// Handle requests for events JSON file
} else if (requestURL.pathname === "/events.json") {
event.respondWith(
caches.open(CACHE_NAME).then(function(cache) {
return fetch(event.request).then(function(networkResponse) {
Hi,
The issue I came across occurs in Chrome and Safari, whereas works fine in Firefox(most of the time). fetch() request for events.json always resolves even in offline mode. I have added an OnlineState counter as you can see in the below code. Chrome keeps triggering this Online state even in offline mode (as can be observed from the added number of Online Requests) whereas Safari most of the time does not trigger this resolved promise at all (as can be observed from the not increasing number of Online Request). Safari only triggers Resolve function when I shift+refresh the page to delete cache and only then on my following regular refresh I can see the Resolve function triggered. So I think this is a browser file caching related problem. However, how come a failed fetch event, trigger a function inside a resolved promise in Chrome? And how come a supposedly successful fetch event not resolve in Safari?
//Added this variable before the serviceWorker fetch eventListener
var onlineRequest = 0;
// Handle requests for events JSON file
} else if (requestURL.pathname === "/events.json") {
event.respondWith(
caches.open(CACHE_NAME).then(function(cache) {
return fetch(event.request).then(function(networkResponse) {
The text was updated successfully, but these errors were encountered: