简体   繁体   English

Chrome:为localhost禁用相同的原始策略

[英]Chrome: Disable same origin policy for localhost

I'm developing a phonegap/cordova app, it is not bound by same origin policy for the sites I care about. 我正在开发一个phonegap / cordova应用程序,它不受我关心的网站的相同原始政策的约束。 I use the chrome browser for fast development, which I cannot do if it is bound by same origin policy. 我使用chrome浏览器进行快速开发,如果它受同一源策略的约束,我就无法做到。 There is a great 3 year old answer on how to completely disable the cross origin policy. 关于如何完全禁用跨源策略,有一个很好的3年回答 But having a browser opened with completely disabled web security seem like a recipe for disaster. 但是,在完全禁用Web安全性的情况下打开浏览器似乎是一种灾难。

Since the anser is 3 years old I'm hoping there might now be a way to disable same origin policy on a per URL basis. 由于anser是3岁,我希望现在有一种方法可以在每个URL的基础上禁用相同的原始策略。 Either that all webpages at localhost is fine to use cross origin or that it's always okay to request data from www.example.com and www.otherexample.com? 要么localhost的所有网页都可以使用交叉来源,要么始终可以从www.example.com和www.otherexample.com请求数据?

You can use fiddler, one of it's auoto responder options is to fake cors respnce, omong many more. 你可以使用fiddler,它的一个auoto响应器选项是假的cors respnce,omong更多。 I use it quite a bit. 我用了很多。 It can alsow fake an api responce with a local file, i find it quite invaluable when developing frontend before backand is ready. 它可以使用本地文件伪造api响应,我发现它在开始前端并且准备就绪之前非常有价值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM