Cannot read property 'addEventListener' of undefined --- navigator.serviceWorker.register('worker.js')
I am trying to get a javascript to work, however. It is giving me some issues. The demo of the working script from the author is here. https://toohotradio.net/metadata/ I am using the same code he has on his demo page. I downloaded the worker.js and have it stored in my JS folder. So it looks like this in the code.
if ('serviceWorker' in navigator) { var iceworker = navigator.serviceWorker.register('worker.js')//I get this error in Google ChromeUncaught TypeError: Cannot read property 'addEventListener' of undefined//For this line.navigator.serviceWorker.addEventListener('message', event => {
I've gone through his code and replaced every section with his domain, to point to mine. This is the source link for the javascript function. Source Code for Javascript Can someone please assist me in getting this working? Thank you. Wayne