0

I want to bypass CORS Policy to GET data XML from another domain. I try so much but have no luck. There are:

  • JSONP : By this way, i don't know how to use it. Because XML Construction is difference from JSONP Construction. If yes, please help me how to use JSONP to get data XML from another domain.
  • Proxy: Cause of my project is ASP.NET Framework 4.0. So, i create a proxy page and use it to get XML. Example: http://localhost:4030/proxy.aspx?u=http://onotherdomain.com/data.xml . But i can't get data with a basic protected site. It's allways return 401 unauthorized.

For you, JSONP is faster or Proxy is Faster ?

Thanks for watching ?

1 Answer 1

1

If the other domain does not explicitly trust you, you cannot invoke it from the client via AJAX for security reasons unless you use JSONP.

However, you can only use JSONP as long as you are sticking to only GET requests and the server knows how to respond with a JSONP-formatted response.

On the other hand, if they DO explicitly trust you, you have a few options.

  • CORS support on the server as long as you are using modern browsers (IE9 still has issues with this) with the appropriate headers.
  • XDomain, which is essentially a javascript proxy shim. However, this also requires explicit request domain inclusion.

On the other hand, if you create a proxy server-side on your end that can call across to the other domain, you'll have no issues whatsoever.

A server-side proxy should in theory always be slower than ajax options since you are making two calls instead of one.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.