CORS take 2–IE edition

I successfully implemented CORS in Firefox and Chrome, but could not get it to work in IE.  No surprise right?  My issues were:

  1. 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;
  2. 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:
    1. 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.
    2. 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.
  3. 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…

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s