d3.csv("cities.csv", function(data) {
console.log(data[0]);
});
This does not seem to work, and I get the error Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.
Now, I'm absolutely not familiar with HTTP and servers and have looked a bit around, but am quite confused about it. Should I make a local server (or something like that) using Python's -m SimpleHTTPServer, or is there another way around? Why does this problem arise?
Thanks for all the input!
Gabriel
Hi Gabriel,
This issue pops up when you try and load the website locally on your machine. To avoid this error you either need to run a localhost on your machine or upload it to a web server. If you are running this on a Mac you can run a simple local web server by cd -ing into the root folder in Terminal and running “python -m SimpleHTTPServer”. Heres a tutorial: http://lifehacker.com/start-a-simple-web-server-from-any-directory-on-your-ma-496425450 <http://lifehacker.com/start-a-simple-web-server-from-any-directory-on-your-ma-496425450>.
Good luck, cheers,
Danne Woo
--
You received this message because you are subscribed to the Google Groups "d3-js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to d3-js+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Thanks for your response. One more question: once this localhost is run (which I could do with success), should I put a file in it? Or should I just let it open without doing anything with it?
Thanks for the clarification!
Best wishes,
Gabriel
Gabriel