cesium billboard跨域问题
作者:互联网
群里小伙伴问道使用billboard加载图片时出现跨域问题,一般认为在服务器设置
Access-Control-Allow-Origin: *
就可以实现跨域访问,但是服务器不设置,<img>图片依旧可以跨域访问,但是billboard就会出现跨域报错问题
Access to image at 'https://xuxinghttps.oss-cn-qingdao.aliyuncs.com/zjl/img/ccb191fb937cd8464435f7da069ff2f3.png' from origin 'http://app.sdzhujialin.com' has been blocked by CORS policy:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
为什么cesium的billboard会出现跨域问题,它的源码里到底是这么加载图片的?
viewer.entities.add({ position : Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883), billboard :{ image : 'http://localhost:8080/img/ccb191fb937cd8464435f7da069ff2f3.png' } });
查到两篇博客
分析three.js加载图片跨域问题,和cesium的问题类似
https://www.jianshu.com/p/8fa0fb53c183
讲解crossorigin="anonymous"属性,在<img>标签加入crossorigin="anonymous",确实会出现跨域问题
https://www.jianshu.com/p/a45c9d089c93
标签:跨域,Access,billboard,https,cesium,com 来源: https://www.cnblogs.com/SmilingEye/p/11363837.html