0

In my project I have such line of code

navigator.serviceWorker.register('{% static "js/firebase-messaging-sw.js" %}')

But if I launch my project not on localhost, I got an error Uncaught TypeError: Cannot read property 'register' of undefined

Headmaster
  • 2,008
  • 4
  • 24
  • 51

1 Answers1

0

I need to serve page over HTTPS or use localhost. Service workers require a Secure Context.

Here is the link to original answer

Headmaster
  • 2,008
  • 4
  • 24
  • 51