Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I know that D3.js supports loading data files with XHR and JSONP requests.

However in my case, I am going to run .html files by double clicking on them from filesystem, which is going to run it like file://.../foo.html on browser.

Is it possible to load data file (csv or json) within the same directory from computer as foo.html on browser (while not running on http:// but file://)?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
547 views
Welcome To Ask or Share your Answers For Others

1 Answer

The best solution would be to run a server on your computer to make it work.

The simplest way to have a local web server, as explained here is to run this command in the directory where you have your source code:

python -m SimpleHTTPServer 8888 &

Then just load the page http://localhost:8888


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...