在 Chrome 中禁用同源策略 [英] Disable same origin policy in Chrome

查看:74
本文介绍了在 Chrome 中禁用同源策略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以禁用 Google 同源政策http://en.wikipedia.org/wiki/Google_Chrome" rel="noreferrer">Chrome 浏览器?

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

推荐答案

关闭 chrome(或 Chromium)并使用 --disable-web-security 参数重新启动.我刚刚对此进行了测试,并验证了我可以访问嵌入在localhost"(在chromium 5/ubuntu 下测试)提供的页面中的 src="http://google.com" 的 iframe 的内容.对我来说,确切的命令是:

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:

注意:在运行命令前杀死所有 chrome 实例

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.

来自铬源:

// Don't enforce the same-origin policy. (Used by people testing their sites.)
const wchar_t kDisableWebSecurity[] = L"disable-web-security";

<小时>

在 Chrome 48 之前,您可以只使用:


Before Chrome 48, you could just use:

chromium-browser --disable-web-security

这篇关于在 Chrome 中禁用同源策略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆