0

I'm trying to read in a csv file from my ftp server. The link looks something like:

ftp://192.168.5.11/N2/CB/data.txt

However, d3 doesn't like it.

In chrome I get the following error:

XMLHttpRequest cannot load ftp://192.168.5.11/N2/CB/data.txt. Cross origin requests are only supported for HTTP. 

I have a large amount of data files ~12GB and the ftp server is the most convenient way for me to store my data online

Any ideas on how to fix this?

Omar Wagih
  • 8,504
  • 7
  • 59
  • 75

1 Answers1

3

This is not a problem with D3, but with Javascript's security policies. The page is in location x and you're trying to load data from location y. As the error message says, this is not allowed if the location you're trying to load data from is an FTP server.

You might be able to work around this by disabling the security mechanisms in your browser. In general, this is not a good idea and will certainly not work for anybody else. Your only other alternative is to host the file you want to load on a HTTP server.

Lars Kotthoff
  • 107,425
  • 16
  • 204
  • 204
  • Thanks. I set up a simple http server with python, but It still fails: XMLHttpRequest cannot load http://192.168.5.11/N2/CB/data.txt. Origin http://localhost:9000 is not allowed by Access-Control-Allow-Origin. – Omar Wagih Apr 29 '13 at 15:28
  • This is again the security policy. The easiest thing is to put both document and data on the same server. – Lars Kotthoff Apr 29 '13 at 15:42
  • I also tried that. I am using Play Framework to create my web app. When the assets are on the same web server, it will barely compile. Maybe I should ask this question in the play framework community. Thanks guys – Omar Wagih Apr 29 '13 at 15:47
  • 1
    I'm not sure what sort your data looks like, but if you have to host the files on another server you could convert them to jsonp objects and still access them. http://stackoverflow.com/questions/2067472/what-is-jsonp-all-about – Adam Pearce Apr 30 '13 at 21:01