3

This answer Register service worker in angular.js application had some helpful points, but I'm still running into issues.

The strange thing is that I know service workers work on my setup because I've gone through the wittr demo https://github.com/jakearchibald/wittr and had some exposure to service workers already.

Now I'm trying to get service workers setup in my angularJS app https://github.com/ianemcallister/Public_Transportation_App. I'm getting the following error in my canary devtools console:

GET http://localhost:9000/sw.js net::ERR_INSECURE_RESPONSE

ServiceWorker registration failed:  DOMException: Failed to register a ServiceWorker: The script has an unsupported MIME type ('text/html')

I'm pretty much copying and pasting from the example file. Does it have to do with the build process or something about how the files are being served up locally (both are running on local host)?

I scaffolded my angular app with https://github.com/angular-fullstack/generator-angular-fullstack and the example app has nothing to do with angular, that's the only thing I can think of.

If anyone can point me in the right direction I'd greatly appreciate it!

1
  • And now I'm just confused. In the resources->Service Workers window it's showing two tabs, under local host it lists the service worker as active, but then below that it lists the same worker as stopped with a redundant state. When I delete the redundant one it seems to be working, should I just ignore the error? Commented Apr 13, 2016 at 16:48

1 Answer 1

5

Ugh, the answer was painfully simple, I was referencing the wrong file path name. Once it was correctly set the error went away. It's just a confusing error message.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.