I am trying to add a fully custom HTTP header - in this case, as an example, Header = dog with value = cat. When I run this, instead of getting a new header, does it add the dog to the values ββin the request-access control headers? How to get a new custom header?
the code:
HR = new XMLHttpRequest(); HR.onload = function (e) { } HR.open("GET", URI); HR.setRequestHeader('dog', 'cat'); HR.send();
Request titles viewed with the Chrome Developer Tools:
access-control-request-headers: origin, dog access-control-request-method: GET origin: http://localhost:8888 accept-encoding: gzip,deflate,sdch accept-language: en-US,en;q=0.8 user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36 :path: / accept: */* :version: HTTP/1.1 cache-control: max-age=0 referer: http://localhost:8888/x.html :scheme: https :method: OPTIONS Response Headersview source access-control-allow-headers:origin, dog access-control-allow-methods:OPTIONS access-control-allow-origin:* access-control-max-age:300 cache-control:private, no-cache, no-store, must-revalidate content-length:0
source share