2

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.

hippietrail
  • 15,848
  • 18
  • 99
  • 158
Ozzah
  • 10,631
  • 16
  • 77
  • 116

2 Answers2

2

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.

epascarello
  • 204,599
  • 20
  • 195
  • 236
  • The __Same Origin Policy__ is referred to different domains, protocols and ports, not to differents IPs ;) . See http://en.wikipedia.org/wiki/Same_origin_policy. However, +1 for state the __JSONP__ option, currently the unique crossbrowser way to do this (several browsers have protected variables that can be manipulated through javascript to accomplish that, but are differents). – Diosney Aug 22 '11 at 16:07
  • 1) I don't control the IP of the target server, unfortunately, and 2) The server has no JSONP code - The code I have currently downloads the html content and finds a particular element to get what I need. – Ozzah Aug 22 '11 at 22:36
  • @Ozzah, sounds like you are out of luck unless you can get a proxy to work or work with the other server and get them to return content you can use. :) – epascarello Aug 22 '11 at 23:26
  • This answer is incorrect - IE8 absolutely does support the Cross Origin Resource Sharing specification. It doesn't support it in XMLHttpRequest, but CORS is an independent standard that can be applied to anything. IE8 and IE9 have CORS support in XDomainRequest. Less than ideal of course, but still a (mostly) valid implementation of it. – ShadowChaser Dec 20 '14 at 18:51
0

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.

Mihai Iorga
  • 39,330
  • 16
  • 106
  • 107