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
  • 1,808
  • 3
  • 23
  • 45

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
  • 1,808
  • 3
  • 23
  • 45