Disabling Same-Origin Policy in Chrome
Question:
How can the same-origin policy be disabled in Chrome?
Answer:
To disable the same-origin policy in Chrome, follow these steps:
-
Close Chrome: Quit all instances of the browser.
-
Restart with Argument: Launch Chrome using the following command:
chromium-browser --disable-web-security --user-data-dir=[some directory here]
Copy after login
-
Ignore Warning: Upon opening, Chrome will display a warning about using an unsupported command. Ignore this message.
-
Disable Policy: The same-origin policy is now disabled.
Note:
- All Chrome instances must be closed before running the command.
- This method was tested with Chromium 5 on Ubuntu and allows access to the contents of an iframe with the source "http://google.com" from a localhost-served page.
- In Chrome versions prior to 48, the command was simply "chromium-browser --disable-web-security".
The above is the detailed content of How to Disable the Same-Origin Policy in Chrome?. For more information, please follow other related articles on the PHP Chinese website!