背景说明:前端小白,不断补坑中,欢迎个各路大神拍砖~
问题描述:本地无法加载XXX.geojson文件(chrome浏览器);FireFox浏览器可以加载显示。
错误提示:
ajax.js:25XMLHttpRequest cannot loadfile:///E:/Web/201707/marathon0711/course.geojson. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
解决办法:将网页通过服务器(IIS)发布,依然存在上述问题,不要气馁继续找。提示为找到XXX.geojson资源
右击“MIME”→打开功能,如图。
可以实现mapbox加载geojson文件
感谢: http://www.cnblogs.com/chen-lhx/p/6737297.html
ajax.js:25
XMLHttpRequest cannot loadfile:///E:/Web/201707/marathon0711/course.geojson. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.