mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 10:52:45 +08:00
FIX: Only show offline page when user is offline.
https://meta.discourse.org/t/cannot-load-app-in-firefox-sometimes-refresh-fixes-it/85258
This commit is contained in:
parent
9eabf7c02c
commit
d2d3c7d24e
|
@ -80,7 +80,11 @@ self.addEventListener('fetch', function(event) {
|
|||
// If fetch() returns a valid HTTP response with an response code in the 4xx or 5xx
|
||||
// range, the catch() will NOT be called. If you need custom handling for 4xx or 5xx
|
||||
// errors, see https://github.com/GoogleChrome/samples/tree/gh-pages/service-worker/fallback-response
|
||||
return caches.match(OFFLINE_URL);
|
||||
if (!navigator.onLine) {
|
||||
return caches.match(OFFLINE_URL);
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user