我正在尝试设置自托管VR-TheWorld服务器并使用Cesium进行渲染。
当使用cesium中的WebMapServiceImageryProvider(或TileMapServiceImageryProvider)连接到VR-TheWorld服务器时,它会正确连接和呈现。
当它指向我本地托管的版本时,cesium会抛出错误:
An error occurred while rendering. Rendering has stopped.<br />
SecurityError: SecurityError
我无法弄清楚导致此错误发生的原因,任何正确方向的指针都会受到赞赏。
以下用于连接的HTML页面。
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Web Viewer</title>
<!-- Use correct character set. -->
<meta charset="utf-8">
<!-- Tell IE to use the latest, best version (or Chrome Frame if pre-IE11). -->
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<script src="../Build/Cesium/Cesium.js"></script>
<style>
@import url(../Build/Cesium/Widgets/widgets.css);
html, body, #cesiumContainer {
width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden;
}
</style>
</head>
<body>
<div id="cesiumContainer"></div>
<script type="text/javascript">
var viewer = new Cesium.Viewer('cesiumContainer', {
imageryProvider: new Cesium.WebMapServiceImageryProvider({
url: 'http://www.vr-theworld.com/vr-theworld/tiles?',
//url: 'http://vrtw.local/tiles?',
layers: 1
}),
//imageryProvider: new Cesium.TileMapServiceImageryProvider({
//url: 'http://www.vr-theworld.com/vr-theworld/tiles1.0.0/1/',
//url: 'http://vrtw.local/tiles1.0.0/1/',
//fileExtension: 'jpeg'
//}),
baseLayerPicker: false
});
</script>
</body>
</html>