简体   繁体   English

除非我使用Chrome,否则HttpRequest失败

[英]HttpRequest Fails Unless I Use Chrome disable-web-security

I am making an httprequest to a third-party server ( http://remysharp.com/demo/cors.php ) where I have CORS properly enabled (at least according to http://client.cors-api.appspot.com ). 我正在对已正确启用CORS的第三方服务器( http://remysharp.com/demo/cors.php )发出httprequest(至少根据http://client.cors-api.appspot.com )。 This fails in all browsers except when I use disable-web-security in Chrome. 除了在Chrome中使用disable-web-security之外,所有浏览器均无法通过此操作。 How do I overcome this so that it works without using disable-web-security? 如何克服此问题,使其在不使用禁用网络安全的情况下起作用?

If you using AJAX(javascript) to request third-party server ,it's response header should set: 如果您使用AJAX(javascript)请求第三方服务器,则其响应标头应设置为:

Access-Control-Allow-Origin:*//or your domain

But if you can't set third-party server's response header like this,you can't making an http request by javascript 但是,如果您不能像这样设置第三方服务器的响应标头,则无法通过javascript发出http请求

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

相关问题 "如何在 Jmeter Webdriver Sampler 中禁用“Chrome --disable-web-security”?" - How to Disable "Chrome --disable-web-security" in Jmeter Webdriver Sampler? 仅在选定的网站上,Chrome上可能会“禁用网络安全性”吗? - Is it possible “disable-web-security” on Chrome for only selected web sites? 是否有针对Chrome~70最近更改的--disable-web-security修复程序? - Is there a --disable-web-security fix for recent changes of Chrome ~70? 在JavaScript中设置Google Chrome浏览器的disable-web-security标志 - Set Google Chrome's disable-web-security flag in JavaScript 在Node JS中使用--disable-web-security标志生成Chrome - Spawn chrome with --disable-web-security flag in node js --disable-web-security for all browsers - --disable-web-security for all browsers CORS 插件 / --disable-web-security 如何在浏览器上工作? - How does CORS plugin / --disable-web-security work on browser? Chrome扩展程序禁用网络安全 - Chrome extensions disable web security 量角器 - 启动 chrome 以禁用 cors 的网络安全 - protractor - launch chrome with to disable web security for cors Chrome禁用网络安全相同的来源政策不再有效 - Chrome disable web security same origin policy no more working
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM