Check that SW is actually registered before using for first time

This commit is contained in:
Jaifroid 2023-01-21 08:33:00 +00:00
parent d53d3aa433
commit e22ac9d920

View File

@ -4991,7 +4991,7 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'utf8', 'cache', 'images
return encodeURIComponent(m); return encodeURIComponent(m);
}); });
if (params.contentInjectionMode === 'serviceworker') { if (params.contentInjectionMode === 'serviceworker' && navigator.serviceWorker.controller) {
// Remove page max width restriction if required // Remove page max width restriction if required
if (params.removePageMaxWidth) htmlArticle = removePageMaxWidth(htmlArticle); 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 // For UWP apps, we need to add the Zoom level to the HTML if we are opening in external window