HiveBrain v1.2.0
Get Started
← Back to all entries
patternjavascriptCritical

Disable same origin policy in Chrome

Submitted by: @import:stackoverflow-api··
0
Viewed 0 times
disablesamepolicychromeorigin

Problem

Is there any way to disable the Same-origin policy on Google's Chrome browser?

Solution

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).

Note: Kill all Chrome instances before running this command.

For me the exact command was:

chromium-browser --disable-web-security --user-data-dir="[some directory here]"


The browser will warn you that "you are using an unsupported command line" when it first opens, which you can ignore.

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";


Before Chrome 48, you could just use:

chromium-browser --disable-web-security

Code Snippets

chromium-browser --disable-web-security --user-data-dir="[some directory here]"
// Don't enforce the same-origin policy. (Used by people testing their sites.)
const wchar_t kDisableWebSecurity[] = L"disable-web-security";
chromium-browser --disable-web-security

Context

Stack Overflow Q#3102819, score: 1307

Revisions (0)

No revisions yet.