Cross-Site XmlHttp (XDomainRequest)

2019-07-18 03:44发布

I'm writing a web-based tool for my company and it is running off the local intranet and running in IE8. I believe since the company computers are in a SOE, nobody has control over the browser settings except the IT department and they will be unlikely to make any changes, at least not in the timeframe we need it.

I have an XmlHTTP request to a URL which is in "Trusted Sites" (also on the local intranet), but when I send the request, I get an exception: "Access is denied", and when I catch the exception and output it to my page, I get "TypeError: Access is denied".

Is there any way I can get IE8 to complete this AJAX request?

Edit: Upon further researching, it turns out that the problem may not have anything to do with trusted sites/local intranet after all. Apparenly you can't do cross-domain XmlHttp requests. My system is accessed by an IP address, whereas the target site of my AJAX script is (still local) a domain, which resolves to a different IP address. Unfortunately I've already tried writing a PHP script which will get the page from the server-end, however it also refuses to connect without a username/password.

At this stage I'm open to any hacky suggestions on how to get around this. If I can get this function to work, it will save us days of manually inputting data.

2条回答
迷人小祖宗
2楼-- · 2019-07-18 04:08

Since IE8 does not support CORS you either have to do a proxy or make the request with JSONP or get everything under the same IP.

查看更多
女痞
3楼-- · 2019-07-18 04:17

Yes, no matter if requests are on same server, you cannot do cross-domain XmlHttp requests. I don't know what are you trying to achieve but you can't do that with your listed tags.

You should consider some programming.

You can make a little proxy page in any programming you want and make those XmlHttp requests threw that proxy.

查看更多
登录 后发表回答