IE 10 & 11 CORS Status 0

2020-07-18 05:40发布

I have an IE bug I can't seem to figure out. I am supporting IE 10 and 11 only so I thought I could get away with the following code.

I have an AJAX request:

$.ajax({
    type: {method},
    url: {url},
    cache: false,
    crossDomain: true,
    data: {data to send},
    success: function (data, textStatus, xhr) {
       ///success code
    },
   error: function (xhr, textStatus, errorThrown) {
       //error code
   }
});

This code works great in Firefox and Chrome. It doesn't work in IE 10,11. I was under the impression that CORS was fixed in IE 10,11 no?

Why do I get the follow error in IE 10,11?

{"readyState":0,"status":0,"statusText":"Error: Access is denied.\r\n"}

1条回答
Root(大扎)
2楼-- · 2020-07-18 06:33

So I needed to enable 'Access data sources across domains'.

Steps:

  1. Select Internet Options
  2. Select the Security Tab
  3. Select Custom level...
  4. Scroll down to Miscellaneous
  5. Find Access data sources across domains
  6. Change the value to Enable
查看更多
登录 后发表回答