1

I get below error when trying to load this D3 in Internet Explorer 11 on Windows 7:

SCRIPT 5 : Access is denied
d3.min.js, Line: 1, Column: 10922

Researching the error, msdn says, it is due to Same-Origin Policy. But I saved all files - d3.min.js , flare.json and html file - locally in the same directory. I also lowered Security setting on all zones, and added <meta http-equiv="X-UA-Compatible" content="IE=edge" /> , but no luck.

It works fine on Firefox & Chrome though. It also works fine on IE if I include the content of json within the html as a javascript variable like var data = {"name":"flare",...} , but not when reading from an external .json file.

I guess this is impossible to do in IE.. ?

EDIT-SOLUTION: The problem was because I was trying to do this on my local computer. Once I uploaded the files to a Sharepoint website, it opened fine.

4
  • Are you hosting the files on a web server or you access the HTML from browser with file://? Commented Jul 24, 2015 at 2:09
  • i'm using file:// to test it on my local PC Commented Jul 24, 2015 at 3:05
  • This doesn't work. Read my answer. Commented Jul 24, 2015 at 3:10
  • possible duplicate of Javascript: can't load JSON file from localhost Commented Jul 24, 2015 at 13:29

1 Answer 1

1

If you access the HTML file directly with the browser with file:// this error is because the access is restricted to the same protocol, host and port. With AJAX always you've to access the file via HTTP(S) and d3.json() uses AJAX to load the JSON file. If the JSON is hosted on other domain the error is probably because CORS restriction on the other side.

https://en.wikipedia.org/wiki/Cross-origin_resource_sharing

Sign up to request clarification or add additional context in comments.

2 Comments

OK, I put the directory on a web server, created an IIS application, changed the paths to http:// and accessed it remotely. The Access denied error is gone, but now I get this error - object XMLHttpRequest on IE11 and object XDomainRequeston IE 9
I was able to get it to work on Sharepoint website instead of regular IIS. I copied all js,json,css to the same folder, and accessed them in the html by simply giving file name "d3.js", or "flare.json", without any file:// or http:// qualifiers in front.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.