I'm using jQuery .load() to load some pages in a div. I'm testing a mobile web site with Chrome's mobile web site emulator.
Apart this, the thing is that I get this error:
XMLHttpRequest cannot load .../www/pages/welcome_header.html. Received an invalid response. Origin 'null' is therefore not allowed access.
Indeed this i a problem CHrome only has.
It looks that a solution is to use
--allow-file-access-from-files when starting Chrome.
But how do I do it on Windows 8?
I tried with
"run" ==> "chrome --allow-file-access-from-files".
But had not effect
Thanks in advance for any clue.
update: proof that it works on my Windows 8 machine, and some troubleshooting steps for you:
Detailed steps/troubleshooting:
Run the following command (from "run" menu, cmd.exe, or batch file):
chrome --disable-web-security --allow-file-access-from-files
update 2:
The error message you are getting is different from what I get when I omit --allow-file-access-from-files
:
XMLHttpRequest cannot load file:///C:/Users/.../main.coffee. Cross origin requests are only supported for HTTP.
XMLHttpRequest
. Check the browser debugger's network tab. Perhaps Chrome interprets your file URL differently than other browsers?(...and I guess --disable-web-security
is not required.)
Chrome must be passed --allow-file-access-from-files
when it first starts. Make sure all instances of Chrome are closed, first (otherwise the instance without the parameter is re-used). I would also add --disable-web-security
for good measure. Chrome should display a yellow notification banner warning about unsupported and unsecure settings.
I've been doing this to locally test a hybrid app for iPad.