"Source null is not allowed in Access-Control-Allow-Origin" in Chrome. What for?

I am working on some Javascript to run locally on my PC. I am using the jQuery CSV plugin (http://plugins.jquery.com/project/csv) to load a downloadable csv file into javascript arrays. The script is simple:

$(function(){ $.get("file.csv", function(data){ stuff = $.csv()(data); }) }) 

This works fine in Firefox, but Chrome says: "The origin of null is not allowed by Access-Control-Allow-Origin." What does it mean? I find all kinds of threads about cross-server material related to this error, but I just work with local files.

+49
javascript google-chrome cross-domain
Mar 07 '11 at 19:09
source share
4 answers

Chrome does not believe that there is any common connection between any two local files.

You can run it with the option "-allow-file-access-from-files" to indicate that you do not agree.

Thanks to ascendant master Nick Craver for this information when I asked essentially the same question a while ago.

+89
Mar 07 '11 at 19:12
source share

If you are using Mac OS X, open a terminal, cd to the root directory and run:

 python -m SimpleHTTPServer 

Then open the following URL in Chrome (or any other web browser):

 http://0.0.0.0:8000 
+17
Mar 22 '13 at 18:02
source share

This seems like a cross-domain for some unknown reason (each browser has a slightly different attitude to this problem, you can even try IE and see the results). You should try to run it through the web server and give it an absolute path, since javascript is executed locally.

+2
Mar 07 '11 at 19:12
source share

You can try running it on your apache web server. He will work.

-one
Nov 29 '12 at 10:14
source share



All Articles