Home » Javascript » DOMException: Requesting https url results in insecure operation

DOMException: Requesting https url results in insecure operation

Posted by: admin October 29, 2018 Leave a comment

Questions:

Good day,

I’m working on a react app. I’m running into problems registering the service worker. It says the domain is not secure.

So I try to register the service worker myself in the javascript console, with the absolute url of the javascript, with ssh.

navigator.serviceWorker.register('https://www.my-domain.com/my-folder1/my-folder2/service-worker.js').then((x) => { console.log('success'); console.log(x); }).catch((y) => { console.log('error'); console.log(y); });

On the other hand, when I go to the service worker url, it shows me the rendered page. Does that have anything to do with the error?

[Edit]

The page I’m running this on is index.html, but this is its exact URL.

https://www.my-domain.com/my-folder1/my-folder2/

Thank you in advance.

Answers: