简体   繁体   中英

Resolve cross-origin issue without proxy

I'm trying to make a webservice call from an html page to the server using XmlHttpRequest. 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. I have access to the server (IIS). I'll need to do GET and POST across the domains. Here's what I've researched so far -

  1. Crossdomain.xml
  2. CORS
  3. JSONP

Is Crossdomain only for for flash players and stuff? CORS kind of seems hard to implement for BOTH client and server. Can JSONP be used for 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.

At this URL, http://enable-cors.org/ they describe the solutions which you can take to enable Cross Domain access.

For example calling a Data Service www.abc.com/Service from www.zzz.com can be done by enabling a cross domain protocol.

Note that the method for configuring IIS6 and IIS7 / 8 are different.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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