Uncaught TypeError: Cannot read property 'register' of undefined

6k Views Asked by At

I'm using pushpad.xyz for push notifications in my wordpress project. I added pushpad code but I get this error which I can't understand.

pushpad.js:292 Uncaught TypeError: Cannot read property 'register' of undefined
    at Object.registerServiceWorker (pushpad.js:292)
    at Object.init (pushpad.js:261)
    at init (pushpad.js:362)
    at window.pushpad (pushpad.js:548)
    at pushpad.js:551
    at Array.forEach (<anonymous>)
    at pushpad.js:550
    at pushpad.js:553

Could some one explain why I'm getting this error. Because this error is coming only in this wordpress project which I'm running in a virtual machine using vagrant. Is this the reason for the error? If yes how can I fix it?

1

There are 1 best solutions below

0
On

The relevant line in pushpad.js that raise the error is the following:

navigator.serviceWorker.register(_.options.serviceWorkerPath, { updateViaCache: 'none' });

Thus the error indicates that navigator.serviceWorker is undefined: probably you are using an old or buggy browser version.