A way around access control origin errors

CORS can be a pain when dealing with AJAX and getting data from other domains. Here's how to disable it.

AJAX, Access Control Origin, Cross Domain

9/15/2011

Ever try to post to a web service or access AJAX data from a different domain, and get those annoying access-control origin errors? Often, these result from the remote host's server configuration being not set up to accommodate requests from your IP. If accessing the remote server is something that is beyond your control, but you still need to be able to test your code, here's an easy way around access-control origin errors.

  • You'll need Chrome (although I'm sure this is possible with other browsers as well).
  • You'll need to open up Terminal
  • Simply paste in the following code:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --disable-web-security