Need a workaround for cross domain ajax post in IE

2019-06-26 09:14发布

问题:

So IE7 does not support CORS (cross origin resource sharing). However, due to nature of my app, I have to make a cross domain ajax post. Is there some way to get this to work in IE7? Unfortunately, I cannot use a server side proxy for security reasons. Perhaps using an iFrame?

I forgot to mention, but I control the other server also.

回答1:

The Easy XDM library was developed to solve the cross origin problem :

easyXDM is a Javascript library that enables you as a developer to easily work around the limitation set in place by the Same Origin Policy, in turn making it easy to communicate and expose javascript API’s across domain boundaries.

I didn't use it yet, but we might have to try it to solve a Http / HTTPS Ajax call problem...

Hope that helps.

Other threads of interests :

  • Ajax using https on an http page
  • AJAX, Subdomains, and SSL


回答2:

Do it the old fashioned way: post the form to an iframe using the external domain. You can listen to the onload event on the iframe to know it has completed.

The other option is to use a server-side proxy and post it from there.