简体   繁体   English

解决跨域问题,无需代理

[英]Resolve cross-origin issue without proxy

I'm trying to make a webservice call from an html page to the server using XmlHttpRequest. 我正在尝试使用XmlHttpRequest从html页向服务器进行Web服务调用。 What is the easiest way to get around the cross-domain issue without using a proxy? 不使用代理来解决跨域问题的最简单方法是什么? The remote server takes XML as the request and the response is also in XML. 远程服务器将XML作为请求,并且响应也采用XML。 I have access to the server (IIS). 我可以访问服务器(IIS)。 I'll need to do GET and POST across the domains. 我需要跨域进行GET和POST。 Here's what I've researched so far - 到目前为止,这是我研究的内容-

  1. Crossdomain.xml Crossdomain.xml
  2. CORS CORS
  3. JSONP JSONP

Is Crossdomain only for for flash players and stuff? 跨网域仅适用于Flash播放器和其他内容吗? CORS kind of seems hard to implement for BOTH client and server. 对于客户端和服务器来说,CORS似乎很难实现。 Can JSONP be used for POST? JSONP可以用于POST吗?

Thanks for any help. 谢谢你的帮助。

Edit: I'm trying to run this on a smart device. 编辑:我正在尝试在智能设备上运行它。

It depends on the version of IIS you are using. 这取决于您使用的IIS版本。

At this URL, http://enable-cors.org/ they describe the solutions which you can take to enable Cross Domain access. 在此URL( http://enable-cors.org/)上,它们描述了可以用来启用跨域访问的解决方案。

For example calling a Data Service www.abc.com/Service from www.zzz.com can be done by enabling a cross domain protocol. 例如,可以通过启用跨域协议来从www.zzz.com调用数据服务www.abc.com/Service。

Note that the method for configuring IIS6 and IIS7 / 8 are different. 请注意,配置IIS6和IIS7 / 8的方法不同。

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

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