mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-13 14:28:38 -04:00
Give more time for Service Worker to load
This commit is contained in:
parent
e22ac9d920
commit
67d2fb4366
@ -4991,7 +4991,7 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'utf8', 'cache', 'images
|
||||
return encodeURIComponent(m);
|
||||
});
|
||||
|
||||
if (params.contentInjectionMode === 'serviceworker' && navigator.serviceWorker.controller) {
|
||||
if (params.contentInjectionMode === 'serviceworker') {
|
||||
// Remove page max width restriction if required
|
||||
if (params.removePageMaxWidth) htmlArticle = removePageMaxWidth(htmlArticle);
|
||||
// For UWP apps, we need to add the Zoom level to the HTML if we are opening in external window
|
||||
@ -5019,7 +5019,11 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'utf8', 'cache', 'images
|
||||
if (!appstate.messageChannelWaiting) {
|
||||
// We put the ZIM filename as a prefix in the URL, so that browser caches are separate for each ZIM file
|
||||
var newLocation = "../" + appstate.selectedArchive._file.name + "/" + dirEntry.namespace + "/" + encodedUrl;
|
||||
if (navigator.serviceWorker.controller) articleWindow.location.href = newLocation;
|
||||
else setTimeout(function () {
|
||||
// The Service Worker needs more time to load
|
||||
articleWindow.location.href = newLocation;
|
||||
}, 0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user