Highcharts 在本地目录下运行
我正在使用一个名为 Highcharts 的 js 库,它只在某些时候工作。
在所有情况下,到库的链接都是相对的,并且我已经证明代码没有错误(至少不是我编写的代码)。我还加载了一个单独的库,该库在所有平台上都能正常工作。
如果我在 IE 中加载页面,地址为:
C:\path\to\file
如果我上传它,则:
http://www.foo-bar.com/path/to/file
这两个都有效。
但是,如果我在 FF 或 Chrome 中本地打开它,则路径为:
file:///C:/path/to/file
最后一个不起作用。有谁知道为什么会这样?
提前致谢。
I am working with a js library named Highcharts and it is only working some of the time.
In all cases the links to the library are relative and I have proven that the code is not at faUlt (at least, not the code I have written). I am also loading a seperate library which works fine on all platforms.
If I load the page in IE the address is:
C:\path\to\file
If I upload it, then:
http://www.foo-bar.com/path/to/file
These both work.
However, if I open it locally in FF or Chrome, then the path is:
file:///C:/path/to/file
This last one doesn't work. Does anyone know why this might be?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里的问题是
Access-Control-Allow-Origin
。我的解决方案是将数据加载为内联 json,而不是链接到其中包含数据的 csv。The problem here was
Access-Control-Allow-Origin
. My solution was to load the data as inline jSON, rather than link to a csv with the data in it.