I want to set some custom HTTP Request Header for IE8. I used XMLHttpRequest to set the request header, but I received Object doesn't support this property or method error message.
I think IE8 used XDomainRequest instead of XMLHttpRequest. Same goes to $.ajax, it failed to set the custom header.
Is there any way to set custom Http Request Header for IE8?
Sample I used with XMLHttpRequest:
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://some.url", true);
xhr.setRequestHeader("CUSTOM", "custom");
xhr.send();
Sample I used with $.ajax:
$.ajax({
url: "http://some.url",
headers: {
'CUSTOM': "custom"
},
type: "GET",
success: function(result, status, xhr) {
},
crossDomain: true
});
For XDomainRequest, when I tried to use the .setRequestHeader(). I get the error message Object doesn't support this property or method. Seems like XDomainRequest has limited functions.