jQuery AJAX request in IE9 not sending Cookie header

I'm using jQuery's ajax .get method to retrieve data from my server. Works perfect in Chrome, but in IE9 it is not sending the Cookie header and that breaks the app. Any idea why? Here's the jQuery code:

$.get(this.server + 'rest/photo/' + this.profileId + '/count', function(data) {


I have the same problem here, I can't get the jQuery .ajax() function to work. The only workaround I found is this:

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" /> 

You can add this meta tag to the top of the page to get it working. But it doesn't feel like a good solution. I think the problem is that the xmlhttprequest object in IE9 is different, so jQuery cannot find the respective object, therefore ajax is not triggering.

I ran into a similar issue to the OP many years later with IE9 which, sadly, is still hanging on.

Every browser I tried, including IE10+, seemed fine with passing cookies to my backend, but IE9 would just drop them. It didn't seem to matter what attributes were on the cookies. The main page and API were on the same domains and the cookies matched, the schemes were the same. I wasn't doing anything with IFRAMES, so the P3P 'potato' hack didn't help.

So I started doing some research on what it was about IE9 that could be different. This Microsoft post was very enlightening, and outlines all the things the IE8 and IE9 did to help lock down CORS security holes:

  • Must use HTTP(S), and both endpoints must use the same scheme
  • Must use GET/POST
  • No custom headers allowed
  • Only text/plain content-type allowed
  • More sensitive to Security Zone settings
  • Cookies will be stripped from the request

That last item about the cookies got me thinking, what if IE9 thought I was making a cross-site request? It certainly looked like it was getting shot down in fine fashion like that. I had already checked some of the obvious things like the scheme and domain, but maybe I didn't check everything.

The solution? Specifically, I was using reqwest as my ajax library. It has a cross-origin parameter, which I had left set to true for some reason. Setting it (correctly) to false did the trick - all my cookies were picked up by the server. So it was a dumb mistake, but I learned a thing or two.

Hope this helps someone!

Need Your Help

How to use jQuery UI

jquery jquery-ui jquery-plugins drag-and-drop

I was trying to learn jQuery drag and drop using the fiddle. Though I am new to jQuery, I am so confused with jQuery and jQuery UI. What else do I need to install?

pass PHP variable values to view page in YII

javascript php yii

I am new to Yii, I wan to pass PHP variable value from my controller to view. can someone please help on this. I am stuck here. I must compute this variable in auto complete field using JavaScript.