“NS_ERROR_DOM_BAD_URI: Access to restricted URI denied”

后端 未结 4 1048
别跟我提以往
别跟我提以往 2021-01-07 19:59

I have an html-file with several d3-graphs directly written in script tags into it. When I outsource one of the graphs into an external js file I get this message \"NS_ERROR

相关标签:
4条回答
  • 2021-01-07 20:26

    I was having the same error and the solution is to have your index.html, script.js and data.json in the same directory.

    0 讨论(0)
  • 2021-01-07 20:26

    I solved this issue by moving the JSON file to a subdirectory of the directory containing my html file.

    BROKEN:

    www/
      code/
        hello.html    # refers to ../data/hello.json
      data/
        hello.json
    

    WORKING:

    www/
      hello.html      # refers to data/hello.json
      data/
        hello.json
    
    0 讨论(0)
  • 2021-01-07 20:31

    I have the same problem and I solved using the json file path like this:

    d3.json("file:///C:/path/...../js/forcetree.json", function(json) {
      root = json;
      update();
    });
    

    if I access this path from the browser the file opens.

    0 讨论(0)
  • 2021-01-07 20:34

    Specify your .json file relative to your .html file root

    Ex:

    d3.json("js/forcetree.json", function(json) {
      root = json;
      update();
    });
    
    0 讨论(0)
提交回复
热议问题