我可以在任何浏览器上禁用SOP(同源策略)进行开发吗? [英] Can I disable SOP (Same Origin Policy) on any browser for development?
问题描述
我想在我的Windows机器上开发JavaScript。你知道一个我可以关闭同源政策的浏览器,所以我可以在本地开发吗? Firefox是最佳的。
I want to develop JavaScript on my Windows machine. Do you know a browser where I can turn off Same Origin Policy so I can develop locally? Firefox would be optimal.
或者如果你知道我可以用于SOAP / WSDL站点的代理,它也会很棒。
Or if you know a proxy I could use for a SOAP/WSDL site it would be great too.
我正在尝试使用 JavaSCript SOAP客户端。
推荐答案
更新6/2012:这在写作时曾经有用,但显然已经没有了。抱歉。
在Firefox中(也可能适用于其他基于Gecko的浏览器),您可以使用以下JavaScript代码段来允许跨域调用:
In Firefox (might apply to other Gecko-based browsers as well) you can use the following JavaScript snippet to allow cross-domain calls:
if (navigator.userAgent.indexOf("Firefox") != -1) {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
}
catch (e) {
alert("Permission UniversalBrowserRead denied -- not running Mozilla?");
}
}
看起来有问题,以实现相同的功能,因此您可以尝试启动Chrome参数 - disable-web-security
。我不知道哪个版本的确有效,但至少诺基亚的 WRT工具附带Chrome安装,实际上允许从其他网站加载内容。
It looks like there's an issue created in the Chromium issue tracker for achieving the same functionality, so you could try starting Chrome with the argument --disable-web-security
. I don't know which builds this works on exactly, but at least Nokia's WRT Tools comes with a Chrome installation that does in fact allow loading content from other sites.
这篇关于我可以在任何浏览器上禁用SOP(同源策略)进行开发吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!