Reputation: 2392
tldr: "Work offline" in Firefox isn't the same as being actually offline. Don't confuse it with Chrome's 'offline' mode in the developer tools
I've just had an odd problem that was made odder by the fact that Firefox and Chrome seem to behave differently
I had a bug where service worker b was accidentally clearing the cache of all service workers on the site on activate.
The site didn't work in Chrome when offline, it was trying to get the files in the fetch call from the server. It did work in Firefox
I have code which shows the contents of the cache as below.
function ShowAllFromCache()
{
console.log("ShowAllFromCache: cache name: " + STARTSW_CACHE)
caches.open(STARTSW_CACHE).then(function (cache)
{
cache.keys().then(function (keys)
{
console.log(keys);
});
});
}
After service worker B had activated and cleared the cache the cache was empty, but I can see in developer tools that the fetch call says the file isn't in the cache and will go to the server. It then says it makes a xhr call, zero duration, to get the file and succeeds. It's not hitting the server
If I physically disconnect the internet then I get an error:
"Corrupted Content Error
The site at has experienced a network protocol violation that cannot be repaired.
The page you are trying to view cannot be shown because an error in the data transmission was detected."
Chrome doesn't work in either scenario.
Upvotes: 0
Views: 695
Reputation: 2392
This is because Firefox's offline mode is not the same as being offline. e.g. go to bbc.com, go offline, refresh the page. You'll still see the page
Upvotes: 0