I'm hosting my code in one place and accessing it from a different origin.
I get the following error when loading a KMZ.
“Uncaught DOMException: Failed to construct ‘Worker’: Script at ‘https://YYYYY.com/ThirdParty/Workers/inflate.js’ cannot be accessed from origin ‘https://ZZZZZZ.com’.”
This is because ThirdParty/zip.js tries to build a worker blindly using the domain that the code is sitting on. The worker code does exist at the target url, but the browser won't allow access to it.
if (obj.zip.useWebWorkers) {
worker = new Worker(obj.zip.workerScriptsPath + INFLATE_JS);
launchWorkerProcess(worker, reader, writer, offset, size, oninflateappend, onprogress, oninflateend, onreaderror, onwriteerror);
} else
launchProcess(new obj.zip.Inflater(), reader, writer, offset, size, oninflateappend, onprogress, oninflateend, onreaderror, onwriteerror);
return worker;
It looks like you should be able to set the `useWebWorkers` value on the zip instance, but there's no way to specify that from KmlDataSource.
Is there any way to get around creating these workers from a different domain? I know the other workers in cesium use the TaskProcessor factory to sidestep cors issues.
Can I somehow do this with the zip dependency?
I think this is the same issue referenced here https://cesiumjs.org/forum/#!topic/cesium-dev/mYpD1-fyjFs/discussion
Cesium Version 1.41.0
Chrome Version 63.0.3239.132