“Cross origin requests” error when loading local file in chrome but in firefox. Why? [duplicate]

流过昼夜 提交于 2019-12-25 08:50:06

问题


I was trying to load a local json file using d3.json method, but I am getting an error.

Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https

But if I load the same in mozilla firefox, it runs perfectly fine. My code is:

d3.json("some_local_file.json", function(e, data) {
    if (e) console.warn(e) // getting this in chrome
    // rest of the code which is executing in firefox
}

Chrome Version is : 59.0.3071.115 (Official Build) (64-bit)

Firefox Version is: 52.0.2 (64-bit)

I am not able to understand that if I am making some mistake or it is related to browser. Please help me to understand this.

Any helpful suggestion will be appreciated!

来源:https://stackoverflow.com/questions/45407378/cross-origin-requests-error-when-loading-local-file-in-chrome-but-in-firefox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!