Access control for cross site requests in Internet Explorer
access-control, cross-domain, internet-explorer, javascript
Solution
I don't believe you can do that directly in Internet Explorer. You have a couple of options:
Set up a proxy forwarding script on the server you do control that can forward the Ajax requests. Make sure that it only forwards to the appropriate destinations that you need so that you don't get turned into an anonymous relay.
Use the `document.domain` trick. Basically you need to create a set of `iframe`s, one for each server you need to make Ajax calls to. Within each `iframe` set the `document.domain` property to exactly match the domain you need to send the Ajax requests to. As to how to populate the necessary data, use DOM manipulation prior to setting `document.domain`. Note that this trick requires the target servers to be in sub-domains of the original. More in this article, with examples.
Problem
I am trying to make an AJAX call from several domains to a single one which will handle the request. Enabling Cross domain in Firefox and Chrome was easy by setting the header on the handling server: ``` header("Access-Control-Allow-Origin: *"); ``` But this doesn't help enabling it in Internet Explorer. When I try: ``` httpreq.send(''); ``` it stops with error Access denied. How can this be enabled in Internet Explorer?