none
Accessing HTTP Response Header Variable RRS feed

  • Question

  • I am using Javascript to access the value of the HTTP Response Variable, Server, and am displaying the value on the web page, as a test. Once this is successful, I will be executing other logic based on the value returned in the variable. Essentially I want to handle some operations differently depending on whether the server is IIS or Apache.

    In my test Javascript, I am alerting all response headers (getAllResponseHeaders()) and the Server response header (getResponseHeader("Server")), then I am passing the value of getResponseHeader("Server") onto a field on the web page.

    I have tested this with 4 browsers, so far. It works fine in Chrome, in Safari on Windows and also in Safari on an iPad tablet. In IE 11, the first time I execute the Javascript, it works correctly, getResponseHeader("Server") returns Apache or Microsoft-IIS/8.0 depending on the backend server. In subsequent executions on IE 11, though, getResponseHeader("Server") returns a null value. If I delete browsing history, it will work again once, but after that I receive null for the value.

    Is this a bug in IE 11? Or is there some setting that will change the behaviour to what I am expecting, and what the other browsers deliver, - the Server response value each time? Or is there a better, more reliable way to retrieve this value in IE?

    Tuesday, March 4, 2014 9:04 PM

Answers