Service Worker Registration Failed

Solved: First thing is service worker only works in secure mode either in https or localhost. It doesnot work in local resources like file:// or http.

and second issue was during registration.

navigator.serviceWorkerContainer
      .register('service-worker.js')
      .then(function(reg){

Use chrome webserver, to run the app or just a simple command in terminal(Mac) would do. python -m SimpleHTTPServer


A weird bug in my case as this all happened without any error on my side. Simply restarting Google chrome fixed it