quot;Origin null is not allowed by Access-Control-Allow-Originquot; in Chrome. Why?(“Access-Control-Allow-Origin 不允许 Origin null在铬.为什么?)
问题描述
我正在开发一些 Javascript 以在我的 PC 上本地运行.我正在使用 jQuery CSV 插件 (http://plugins.jquery.com/project/csv) 将 csv 文件加载到 javascript 数组中.脚本很简单:
I am working on some Javascript to run locally on my PC. I am using a jQuery CSV plugin (http://plugins.jquery.com/project/csv) to load load a csv file into javascript arrays. The script is simple:
$(function(){
$.get("file.csv", function(data){
stuff = $.csv()(data);
})
})
在 Firefox 中它可以正常工作,但在 Chrome 中它显示Access-Control-Allow-Origin 不允许 Origin null".这意味着什么?我找到了各种关于与此错误相关的跨服务器内容的线程,但我只是在处理本地文件.
In Firefox it works fine but in Chrome it says "Origin null is not allowed by Access-Control-Allow-Origin". What does that mean? I find all sorts of threads about cross-server stuff related to this error but I am just working with local files.
推荐答案
Chrome 不认为任何两个本地文件之间存在任何共同关系.
Chrome doesn't believe that there's any common relationship between any two local files.
您可以使用--allow-file-access-from-files"选项启动它,告诉它您不同意.
You can start it with the option "--allow-file-access-from-files" to tell it you disagree.
感谢升天大师尼克·克拉弗(Nick Craver)在我前段时间问基本相同的问题时提供的信息.
Thanks to the ascendant master Nick Craver for this info when I asked essentially the same question some time ago.
这篇关于“Access-Control-Allow-Origin 不允许 Origin null"在铬.为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:“Access-Control-Allow-Origin 不允许 Origin null"在铬.为什么?


- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- addEventListener 在 IE 11 中不起作用 2022-01-01
- Flexslider 箭头未正确显示 2022-01-01
- 失败的 Canvas 360 jquery 插件 2022-01-01
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- 400或500级别的HTTP响应 2022-01-01
- Fetch API 如何获取响应体? 2022-01-01