Running cesium without a server

My problem is quite simple: I’d like to use Cesium just like a static web page.
Well… it works pretty well as standalone, except when it comes to retrieve tiles from Internet. Natural Earth (local) tiles are correctly loaded
I guess there will be a cross-origin issue but for now, I’m facing another problem: the URLs for online imagery are missing http: when Cesium is loaded from a local URL (file://)
Here is a Firebug trace:
An error occurred in “E”: An error occurred while accessing //dev.virtualearth.net/REST/v1/Imagery/Metadata/Aerial?incl=ImageryProviders&key=Aj1ony_-Typ-KjG9SJWiKSHY23U1KmK7yAmZa9lDmuF2osXWkcZ22VPsqmCt0TCt.

The problem is not present on WebGLEarth, which uses Cesium globe as well.

Thanks for your help.

I’m not part of the dev team, but by default, Cesium uses the Bing Maps imagery provider, and the default URL is specified without a protocol. Because of this, it tries to load the Bing Maps API using the same protocol as the page(file://) and thus it fails.

You can configure the imageryProvider for Cesium and set it to Bing Maps. Just make sure to add http:// as part of the URL. See the documentation here.

Well, I’m gonna check this.

Indeed it makes sense and I will then modify the code to force download from http:// instead of //

I’ll tell you if it works

Thanks

I did a quick & dirty test, and replaced “//dev.virtualearth.net/” by "http://dev.virtualearth.net/ directly in the Cesium JavaScript code. I did the same for ESRI tiled imagery.

sed -e -i “s|//dev.virtualearth.net/|http://dev.virtualearth.net/|g” CesiumViewerStartup.js
sed -e -i “s|//services.arcgisonline.com/|http://services.arcgisonline.com/|g” CesiumViewerStartup.js

It worked and I’m now able to see the imagery from both Bing and ESRI, even when Cesium is loaded from disk (file:// URL)

Now, I think next step would be to modify tiles URLs during the download processing and detect URLs starting with “//”