I successfully implemented CORS in Firefox and Chrome, but could not get it to work in IE. No surprise right? My issues were:
- No transport error message: When JQuery builds a ajax response object, it uses a factory to get the transport object. So in some cases IE will use an ActiveX object to make the ajax call. But if the proper transport to use can not be determined you’ll get the “No Transport” error message. So the workaround is to tell jquery to use CORS:
$.support.cors = true;
- Access Is Denied: This was driving me crazy! I wrote a spike that worked fine in IE, but the exact same code would fail to run on my web site. There were 2 reasons:
- Using “localhost” in the ajax url setting – IE really doesn’t like this, so it just chucks an error. I think there is a setting somewhere to enable this to work, but I just replaced “localhost” with my IP address to work around the problem.
- Document Mode : I was forcing my web page to use the IE8 standards document mode. That combination of IE10 browser mode and IE8 standards just made IE ralph all over the place. Removing the “meta” tag from the page header so it would default to plain ol “Standards” fixed it right up.
- IE8 and IE9: Once I had everything working in IE10, I moved on to the other two versions. They laughed at my attempts. So I downloaded a JS jquery addon from MoonScript:
With this script included on the page, I made the ajax calls the same way but the big difference is it worked…