16

I make AJAX calls to URIs which belong to a different domain. Normally in IE I am able to do this via jQuery's CORS support. But this fails in Google Chrome irrespective where CORS support is set or not.

Now I get an error saying something like:

XMLHttpRequest cannot load . Origin http://localhost:8000 is not allowed by Access-Control-Allow-Origin.

Is there a setting in Google Chrome which disables the Access-Control-Allow-Origin restriction?

1
  • 1
    Do you have control over the remote web resource? You could add the Access-Control-Allow-Origin header there. Feb 1, 2012 at 20:18

1 Answer 1

18

There is a command-line switch which does the trick: --disable-web-security

Just call it like follows:

$ chromium-browser --disable-web-security http://localhost:8000/pages/index.html

Make sure the Chrome browser is fully closed, otherwise it will only launch a new instance and the applied option will not work.

6
  • The --disable-web-security option doesn't seam to work on Google Chrome, only on Chromium though. Nov 20, 2012 at 8:36
  • 1
    Tested today in Chrome, works fine.
    – munissor
    Nov 20, 2012 at 17:14
  • 7
    open -a Google\ Chrome --args --disable-web-security executed in the mac terminal works fine for me. It has to be done when Chrome is not running though.
    – iolo
    Nov 21, 2012 at 14:37
  • 2
    Tested on 14-12-2012 on Chrome. Works fine but shows a message saying "You are using an unsupported command-line flag: --disable-web-security. Stability and security will suffer" Dec 14, 2012 at 6:05
  • "Make sure the Chrome browser is fully closed" -- This was key for me. You should open task manager and make sure all the chrome.exe processes are gone.
    – Jonah
    Aug 13, 2013 at 16:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.