views:

95

answers:

3

Is there a way to disable the same origin policy on Google's Chrome browser? This is strictly for development, not production, use.

A: 

Probably not.

I use the URL rewriting features of Charles Proxy to map remote HTTP APIs to URLs that appear to point to my development server when I need to do that kind of thing.

David Dorward
A: 

Answered in http://stackoverflow.com/questions/330427/can-i-disable-sop-same-origin-policy-on-any-browser-for-development.

1st result for Google: disable same origin policy.

mcandre
There are no accepted answers. The others range from "Write a proxy", to Firefox and IE specific answers, to a link to a section of a page on Wikipedia (a section that no longer exists!), to redirecting an entire port (which wouldn't solve any Same Origin problem since it still only lets you access one server at a time). It's all very well linking to the first hit on Google that looks reasonable … but try to make sure it actually answers the question.
David Dorward
"try starting Chrome with the argument --disable-web-security"
mcandre
+2  A: 

Close chrome (or chromium) and restart with the --disable-web-security argument. I just tested this and verified that I can access the contents of an iframe with src="http://google.com" embedded in a page served from "localhost" (tested under chromium 5 / ubuntu). For me the exact command was:

chromium-browser --disable-web-security

From the chromium source:

// Don't enforce the same-origin policy. (Used by people testing their sites.)
const wchar_t kDisableWebSecurity[] = L"disable-web-security";
no
How to do this on OS X?
landon9720