Google Chrome: DOMException: Registration failed - manifest empty or missing Google Chrome: DOMException: Registration failed - manifest empty or missing google-chrome google-chrome

Google Chrome: DOMException: Registration failed - manifest empty or missing


For me it was a redirect. The manifest.json must return a 200 status code (must be directly available from the server), without any redirects.You can check the response via

wget --max-redirect=0 https://example.com/manifest.json

or

curl https://example.com/manifest.json


I faced same issue,added manifest file right after head tag . which worked for me.Cheers!


This may be an issue with your Service Worker scope. I ran into a similar problem when I rearranged my files/directories. Make sure your sw.js is on the same level as your manifest.json, otherwise the service worker won't be able to find your manifest. Try putting them both in the root of your directory. Optionally, you can specify the scope of your service worker by adding it to serviceWorker.register():

if ('serviceWorker' in navigator) {  navigator.serviceWorker.register('/sw-test/sw.js', {scope: '/sw-test/'})  .then(function(reg) {    // registration worked    console.log('Registration succeeded. Scope is ' + reg.scope);  }).catch(function(error) {    // registration failed    console.log('Registration failed with ' + error);  });}

Read more here:https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers