I am working on a proposal to use Cesium embedded as a globe viewer in an application. I would like to avoid deploying a web server along with the application, so I searched in the forum, in google and the documentation all that could help understand how to use Cesium without a web server. I partially succeeded, but the following problem is blocking any progress.
I am using Cesium 1.30 viewer in a browser control (QWebEngineView) and it works fine, as long as the html page with the Cesium viewer is accessed through a (local) web server. However, if I load the html with the file protocol, some things stop working, such as the Animation widget (the displayed clock is stopped) or viewer.flyTo (the camera won’t move when loading KML files). Using a browser such as Chrome (with the --disable-web-security or --allow-file-access-from-files options) it happens exactly the same.
After some debugging I found that the problem is in the returned status code of XMLHttpRequest, which is 0 when using the file protocol (no http status code) causing loadWithXhr.load to fail, even when the response has the correct data (for instance, ‘Assets/approximateTerrainHeights.json’, used in the initialization of GroundPrimitive). If I change loadWithXhr.load to accept a status of 0, everything works ok again. But, of course, changing Cesium.js code is not a solution.
Thanks for any help,