Suddenly, local file access using jQuery's .getJSON is not working for me on Firefox (3.6.13) - only.
I am aware of the problem in getting this to work in Chrome - Problems with jQuery getJSON using local files in Chrome. Using the option --allow-file-access-from-files fixes that.
I now have code that works on IE, Chrome (as above) and used to work on Firefox, until now.
To give you some context:
// get the only json file
var script = _.detect($('script').toArray().reverse(), function(script) {
return script.type === 'application/json';
});
// script.src is now '../../json/foo/foo1.json'
return $.getJSON(script.src, function(json) {
alert('hello');// says 'hello' in IE, Chrome (with arg), used to work in Firefox
});
Specifically, as the small code snippet shows, the .getJSON call fails to return and say 'hello' - the json file in question is on the local file system (eg file:///d/foo/bla.json). The JSON passes JSONLint validator.
I've tried disabling all addons - I also have a VM with Ubuntu & the installation of Firefox installed on it (3.6.13) has the same issue - worked a few days ago, now doesn't. Nothing in my code has changed since it was last working, to my knowledge. I just know someone is going to slap me for forgetting something really dumb.
Firefox shows no errors. That this works on Chrome and IE rules out most obvious mistakes.
Any hints or tips as to why this might suddenly stop working on Firefox, would be greatly appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…