1

I'm trying to load Dygraph a Yahoo Finance CSV. How ever I'm getting a cross domain error. Is there an ajax way around it or is that unavoidable with this setup.

<html>
<head>
<script type="text/javascript"
  src="dygraph-combined.js"></script>
</head>
<body>
<div id="graphdiv3"
  style="width:500px; height:300px;"></div>
<script type="text/javascript">
  g3 = new Dygraph(
    document.getElementById("graphdiv3"),
    "http://finance.yahoo.com/d/quotes.csv?s=AAPL",
    {
      rollPeriod: 7,
      showRoller: true
    }
  );
</script>
</body>
</html>
Blynn
  • 1,411
  • 7
  • 27
  • 48
  • Yahoo Finance doesn't allow cross domain requests. There are some ways you might work around that. http://stackoverflow.com/a/13755172/1524502 and http://stackoverflow.com/questions/3076414/ways-to-circumvent-the-same-origin-policy may be helpful. – jonnybot Nov 22 '13 at 18:54
  • I read the terms of service they don't allow you to load in yahoo finance as it isn't an api. – Blynn Nov 23 '13 at 21:41
  • Oh? Where is that? I skimmed this and didn't find an "no-nos": http://finance.yahoo.com/badges/tos. As an aside, could you either construct a server-side service that can download the files (not sure what your environment is) or use the JavaScript HTTP Request object to create a request that pulls the data for the client, then pass the already-downloaded data into Dygraph? – jonnybot Nov 25 '13 at 15:49

0 Answers0