Chrome 开发者工具错误:
d3.v4.min.js:2 Access to XMLHttpRequest at ‘file:///Users/jeanne/WebstormProjects/d3force-Testset/testset_0.json’ from origin ‘null’ has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
使用WebStorm可以成功打开,但是直接打开本地文件就不显示。
应该是由于json文件跨域导致的BUG。
跨域:指的是浏览器不能执行其它网站的脚本,它是由浏览器的同源策略造成的,是浏览器的安全限制。
在WebStorm下打开的连接为:
http://localhost:63342/d3force-Testset/testset_0.html?_ijt=gsv5ednb4bfrsoqmq597fau4nr
在本地直接打开的连接为:
file:///Users/jeanne/WebstormProjects/d3force-Testset/testset_0.html
问题……它没有解决……打算有空再回来看,我决定还是用IDE打开来解决这个问题
0 条评论