I am getting the above failure in my lighthouse audit. Having looked through SO and here it "should" be working.
There are no errors in the console.
This is the Manifest: -
{
"short_name": "Brotkrumen",
"name": "Brotkrumen Web App",
"description": "Native Background Geolocation POC",
"icons": [
{
"src": "gingerbreadhouse.png",
"sizes": "48x48 128x128 144x144 192x192 512x512",
"type": "image/png"
}
],
"start_url": "/TravelManager.html",
"background_color": "#00ccdd",
"theme_color": "#00ccdd",
"display": "fullscreen"
}
This is the ServiceWorker code: -
'use strict';
/* identification division.
* program-id. echo.
* author. Richard Maher.
*/
var doryRegister = []; // Meet someone new every day.
const INTRO = "GrussGott"; // Tell clients we're new.
const FLEET_MANAGER = "/Fleet/Move"; // Starship control.
const CACHE_NAME = "BrotkrumenV1.0"
self.addEventListener('install',
function (e) {
e.waitUntil(
caches.open(CACHE_NAME).then(function (cache) {
return cache.addAll([
'/TravelManager.html',
'/hg.png',
'/gingerbreadhouse.png',
'/striped-witch-hat.png',
'/brotkrumen.css',
'/echo.js',
'/registerserviceworker.js',
'/brotkrumen.json',
'/TravelManagerPolyfill.js',
'/HandleMap.js'
]).then(() => self.skipWaiting());
})
);
});
self.addEventListener('activate', function(e)
{
e.waitUntil(
caches.keys().then((keyList) => {
return Promise.all(keyList.map((key) => {
if (key !== CACHE_NAME) {
console.log('Removing cache', key);
return caches.delete(key);
}
}));
})
);
e.waitUntil(self.clients.claim());
});
self.addEventListener('fetch', function (e) {
console.log(e.request.url);
if (e.request.url.startsWith(self.location.origin)) {
e.respondWith(
caches.match(e.request).then(function (response) {
console.log("Request " + e.request.url);
if (response) {
console.log("Response " + response.url);
if (e.request.cache === 'only-if-cached') {
e.request.mode = 'same-origin'
}
} else
console.log("No MATCH");
return response || fetch(e.request);
})
);
}
return fetch(e.request);
});
from Lighthouse PWA Audit fail "does not register a service worker that controls page and start_url"
No comments:
Post a Comment