Overriding Access-Control-Allow-Origin restriction in Google Chrome

40,781

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.

Share:
40,781

Related videos on Youtube

deostroll
Author by

deostroll

You are probably reading this space for the WRONG reasons...statistically speaking. Why? Because the SO community isn't so welcoming... But we can make this work...just hang in there... :) https://codeblog.jonskeet.uk/2018/03/17/stack-overflow-culture/amp/ (At least, read the "Jon’s Stack Overflow Covenant" section) About me Software engineer. Loves JavaScript. Python. Science. Astronomy. IoT. Programming. Movies. Computers. Married. 1 Kid. From Kerala, India. Works in Bangalore. More ways to connect -> https://plus.google.com/+ArunJayapal (linkedin, facebook, twitter, blah, blah)

Updated on September 18, 2022

Comments

  • deostroll
    deostroll over 1 year

    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?

    • Jacob Krall
      Jacob Krall over 12 years
      Do you have control over the remote web resource? You could add the Access-Control-Allow-Origin header there.
  • Octavian A. Damiean
    Octavian A. Damiean over 11 years
    The --disable-web-security option doesn't seam to work on Google Chrome, only on Chromium though.
  • compscinoob
    compscinoob over 11 years
    Tested today in Chrome, works fine.
  • iolo
    iolo over 11 years
    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.
  • Vivek Kodira
    Vivek Kodira over 11 years
    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"
  • Jonah
    Jonah over 10 years
    "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.
  • Hasanavi
    Hasanavi about 10 years
    If you are using Mac try this one "open -a Google\ Chrome --args --disable-web-security" Without the quote