getScript() doesn't work for file: in Chrome
|Reported by:||curiousdannii||Owned by:|
|Keywords:||Chrome xmlhttprequest, getscript, ajax||Cc:|
Chrome have some bizarre security policy for XHR file: access: http://code.google.com/p/chromium/issues/detail?id=4197 http://code.google.com/p/chromium/issues/detail?id=40787 http://blog.chromium.org/2008/12/security-in-depth-local-web-pages.html
As getScript prefers to use XHR to load scripts when it can, this means it doesn't work for local files in Chrome (fails silently.)
I'll be hardcoding a fix for this in my app, to not use XHR in file:+Chrome. I don't know if there is a smarter way to detect file: support.
Similarly, JSONP will also not work.
Maybe at the same time errors could be raised for ajax methods which must use XHR?
(For a test case, download http://github.com/curiousdannii/parchment/zipball/master and run tests/download_to_array.html. As getScript neither works nor returns an error, the QUnit stops after just two tests.)