zouyaoji / vue-cesium

🎉 Vue 3.x components for CesiumJS.
https://zouyaoji.top/vue-cesium
MIT License
1.5k stars 321 forks source link

[Bug Report] KMZ files are not rendering using vc-datasource-kml #410

Closed sachinsbgithub closed 1 year ago

sachinsbgithub commented 1 year ago

VueCesium version

3.2.0

OS/Browsers version

All browsers

Vue version

3.3.4

Cesium version

1.107.0

Reproduction Link

https://codepen.io/sachinsbgithub/pen/zYMpxJa

Steps to reproduce

Steps to reproduce

What is Expected?

Kmz data to be rendered properly

What is actually happening?

getting error Uncaught (in promise) DOMException: Failed to construct 'Worker': Script at 'https://unpkg.com/cesium@latest/Build/Cesium/ThirdParty/Workers/z-worker-pako.js' cannot be accessed from origin 'https://zouyaoji.top'. at o (https://unpkg.com/cesium@latest/Build/Cesium/Cesium.js:8315:435867) at dKe (https://unpkg.com/cesium@latest/Build/Cesium/Cesium.js:8315:435582) at LV (https://unpkg.com/cesium@latest/Build/Cesium/Cesium.js:8315:435167) at NV (https://unpkg.com/cesium@latest/Build/Cesium/Cesium.js:8315:436836) at _j.getData (https://unpkg.com/cesium@latest/Build/Cesium/Cesium.js:8315:445430) at async Promise.all (index 0)

zouyaoji commented 1 year ago

It has been reproduced, I will find time to solve it.

zouyaoji commented 1 year ago

When you use a web worker, the browser loads the worker script from a separate file or URL. However, web workers have a security restriction known as the "same-origin policy." This policy means that web workers can only be loaded from the same domain, protocol, and port as the main page that's requesting them. If you try to load a web worker from a different domain, you will encounter the error you mentioned.

Host the worker script on your server: Download the Cesium script and host it on your own server. This way, both the main page and the worker script will be from the same origin, and the error should go away.

sachinsbgithub commented 1 year ago

Thank you for your response

On Sun, Jul 30, 2023, 6:49 AM zouyaoji @.***> wrote:

Closed #410 https://github.com/zouyaoji/vue-cesium/issues/410 as completed.

— Reply to this email directly, view it on GitHub https://github.com/zouyaoji/vue-cesium/issues/410#event-9955850797, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3J6CBFTQMB6XXTP67LZNC3XSWZBJANCNFSM6AAAAAA2F33PBU . You are receiving this because you authored the thread.Message ID: @.***>