今天使用angularjs 中的http去访问我本地的json文件,一直没有结果,后来看了console显示:
这是为什么呢?
接着stackover搜到一篇文章:http://stackoverflow.com/questions/16930473/angularjs-factory-http-get-json-file
好,来解释一下:
1) If you're not running a webserver of any kind and just testing with file://index.html, then you're probably running into same-origin policy issues. See:
http://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy
"Many browsers don't allow locally hosted files to access other locally hosted files. Firefox does allow it, but only if the file you're loading is contained in the same folder as the html file (or a subfolder). "<<<<<<<<<<<<重点还是这句话,其他的points以后参考 fuck!!
2)......
3)....
4)