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


基础教程推荐
- 如何使用JIT在顺风css中使用布局变体? 2022-01-01
- Chart.js 在线性图表上拖动点 2022-01-01
- 直接将值设置为滑块 2022-01-01
- Vue 3 – <过渡>渲染不能动画的非元素根节点 2022-01-01
- Electron 将 Node.js 和 Chromium 上下文结合起来意味着 2022-01-01
- 如何使用TypeScrip将固定承诺数组中的项设置为可选 2022-01-01
- html表格如何通过更改悬停边框来突出显示列? 2022-01-01
- 自定义 XMLHttpRequest.prototype.open 2022-01-01
- 用于 Twitter 小部件宽度的 HTML/CSS 2022-01-01
- 我可以在浏览器中与Babel一起使用ES模块,而不捆绑我的代码吗? 2022-01-01