4

I was trying to generate sunburst chart from the example provided here

What I did is just copy the entire JSON in my local and then the index.html

I didn't do any changes to any of the files.

When I tried to run the html file I'm getting these errors

XMLHttpRequest cannot load file:///C:/Users/VK/Documents/D3%20charts/sunburst/flare.json. Cross origin requests are only supported for HTTP. d3.v3.min.js:1
Uncaught TypeError: Cannot read property 'children' of undefined d3.v3.min.js:2
Uncaught NetworkError: A network error occurred. d3.v3.min.js:1

found a similar question asked here but I don't want to load it form the webserver

Can any one help me to solve the issue.

Community
  • 1
  • 1
Strikers
  • 4,698
  • 2
  • 28
  • 58
  • 3
    Try using Firefox as I think it's more relaxed towards cross browser requests than some other browsers. Otherwise, you might want to look into pythons simple server. – user1614080 Feb 03 '14 at 10:09
  • possible duplicate of [Cross origin requests are only supported for HTTP but it's not cross-domain](http://stackoverflow.com/questions/8449716/cross-origin-requests-are-only-supported-for-http-but-its-not-cross-domain) – Quentin Feb 03 '14 at 10:10
  • @Quentin the solution provided there was to use webserver. I don't want to use a webserver. moreover there are other 2 issue in D3.v3.min.js. – Strikers Feb 03 '14 at 10:13
  • @user1614080 In firefox it is working, But it needs to work on all the browsers right. do you know any way to do so – Strikers Feb 03 '14 at 10:14
  • 3
    @strikers You'll have to run it from a webserver if you want it to work on all browsers. The other errors you're seeing are a result of it not being able to load the file. – Lars Kotthoff Feb 03 '14 at 10:15
  • If you have python installed, then go the the folder where you have downloaded the files, do `python -mSimpleHTTPServer`, and point your browser to `http://localhost:8000/index.html`. Similar solutions exist using node, nginx, ruby, apache, etc. – musically_ut Feb 03 '14 at 13:06

1 Answers1

2

Modern browsers don't support loading files through file:// so the best you can do is load your frontend through a web server.

dasersoft
  • 155
  • 2
  • 13
  • No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. –  Oct 21 '16 at 19:47