[英]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.