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"在铬.为什么?


基础教程推荐
- Bokeh Div文本对齐 2022-01-01
- 如何添加到目前为止的天数? 2022-01-01
- 即使用户允许,Gmail 也会隐藏外部电子邮件图片 2022-01-01
- 在 contenteditable 中精确拖放 2022-01-01
- fetch 是否支持原生多文件上传? 2022-01-01
- Bootstrap 模态出现在背景下 2022-01-01
- npm start 错误与 create-react-app 2022-01-01
- 原生拖动事件后如何获取 mouseup 事件? 2022-01-01
- 检查 HTML5 拖放文件类型 2022-01-01
- Fabric JS绘制具有活动形状的多边形 2022-01-01