jQuery's .getJSON using local files stopped working on Firefox 3.6.13

喜欢而已 提交于 2019-12-01 09:01:44
Pekka 웃

I think this is due to a new security feature in Firefox: You can make local requests only to files that are in the page's directory, or in the sub-directory of the page.

From here (emphasis mine):

In Gecko 1.8 or earlier, any two file: URIs are considered to be same-origin. In other words, any HTML file on your local disk can read any other file on your local disk.

Starting in Gecko 1.9, files are allowed to read only certain other files. Specifically, a file can read another file only if the parent directory of the originating file is an ancestor directory of the target file. Directories cannot be loaded this way, however.

For example, if you have a file foo.html which accesses another file, bar.html, the load will succeed only if bar.html is either in the same directory as foo.html or in a directory contained within the same directory as foo.html.


Footnote from PandaWood: I can confirm setting Firefox's about:config -> security.fileuri.strict_origin_policy to false, as the link you provide shows, is an immediate fix
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!