Languages

Menu
Sites
Language
serviceWorker support?

Testing for ('serviceWorker' in navigator) appears to show support for them however when I try to register the service worker file I get the following error in the chrome developer/debugger:

Uncaught (in promise) DOMException: Failed to register a ServiceWorker: No URL is associated with the caller's document.

Has anyone figured out how to register service workers? Am I going down a rabbit hole?

Help! Thanks.

Responses

4 Replies
Kyle Kirkpatrick

I believe I found the reason... it appears tizen (wearable) runs web apps from file:// and not a web server. serviceWorkers requires being served from a URL for security reasons. Am I understanding this correctly? Is there a workaround? :)

Kyle Kirkpatrick

Another thought on the subject, can Concent Security Policies be used to allow service workers to run from file:// ?

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/worker-src

I noticed I can set them in the config.xml file.

cen

Hi,

at the end, did you find a solution? I'm in the same trouble. I'm developping a web app for smart TV and I want to use serviceWorkers but i have this error: "DOMException: Failed to register a serviceWorker: The document is in an invalid state".

If you serve the serviceWorker from an https web server, it will works?

Many thanks.

 

Nils Thingvall

Hi, I'm also curious if you guys found a solution. I'm hitting the same issue as well, specifically, I get the original poster's error:
**ServiceWorker registration failed:  DOMException: Failed to register a ServiceWorker: No URL is associated with the caller's document.