Re: [slightlyoff/ServiceWorker] Is it possible to serve service workers from CDN/remote origin? (#940)

I don't think this is actually ambiguous in the spec. In step 2 of the [Register](https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#register-algorithm) algorithm we check to make sure that the origin of the (resolved) script URL is the same as the origin of the job's referrer (which more or less is the document that called register). And since we also compare the scope to be same origin with that, that means that the document registering the service worker, the scope of said service worker, and the main script of the service worker all have to be same origin.

You could have your main script (on the same origin as your website) be nothing but an importScripts('https://cdn.example.com/...') though. Currently that has the downside that changes in imported scripts are not taken into account when deciding if a new version of a service worker should be downloaded, but we're changing/fixing that to treat imported scripts the same as the main script for update checks (#839).

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/slightlyoff/ServiceWorker/issues/940#issuecomment-237428808

Received on Thursday, 4 August 2016 01:45:24 UTC