Setting headers in XDomainRequest or ActiveXObject('Microsoft.XMLHTTP')
Asked Answered
B

1

18

I'm trying to do something like this (W3 compliant, DOM):

xhr.setRequestHeader( 'X-Requested-With', 'XMLHttpRequest' );

For ActiveXObject('Microsoft.XMLHTTP') and XDomainRequest (IE8). I'm having no such luck finding it anywhere in microsoft documentation or even google. Any idea how I can achieve this?

Banket answered 17/4, 2010 at 4:3 Comment(0)
E
29

Referring to this post Link See the point three 3. No custom headers may be added to the request

You cannot add custom headers to an XDR object. Hope this helps.

Excitor answered 2/8, 2010 at 7:40 Comment(8)
MSIE shouldn't even exist. I hate that browser. Always breaking the Web. I only use it to download other browsers. And I don't even see how XDomainRequest is useful.Residence
@chx101, If it had not existed, we would not have been able to prefer others :).Excitor
@chk101: While I realise it's fun and easy to criticise MSIE years after the fact for its "missing" features, it's definitely worth remembering that the first CORS working draft was introduced March 17, 2009 -- exactly two days before IE8 was released. It didn't become a W3C Proposed Recommendation until December 2013. As a point of comparison, Firefox didn't support CORS in a production release until summer 2009 (version 3.5).Jeffery
@Warren So I should feel bad for microsoft deciding to force a broken update model onto its consumers?Durrace
I'm not in a position to advise you on your feelings -- I'm just outlining the history as it happened five years ago. (People sometimes forget what order things happened)Jeffery
Note that Firefox supported CORS less than half a year after the working draft was introduced. IE didn't support credentialed requests until IE10, September 2012.Beryllium
@Furqan the post you have mentioned is about XDR, but can we set a custom http header to the Microsoft.XMLHTTP?Manganate
@Manganate at the time of this post(in 2010) , with IE 8 it did not support that. It does now.Excitor

© 2022 - 2024 — McMap. All rights reserved.