W3C home > Mailing lists > Public > whatwg@whatwg.org > May 2014

Re: [whatwg] HTTP status code from JavaScript

From: Karl Dubost <karl@la-grange.net>
Date: Mon, 26 May 2014 10:10:24 +0900
Message-Id: <EFD6CAEC-16C4-47AF-949C-8F3BBE1465C8@la-grange.net>
To: Michael Heuberger <michael.heuberger@binarykitchen.com>
Cc: whatwg@lists.whatwg.org
Michael,

A praise for more than HTTP status code.

Le 23 mai 2014 à 12:36, Michael Heuberger <michael.heuberger@binarykitchen.com> a écrit :
> There is a need to obtain the HTTP status code for the page itself from
> JavaScript:
> https://bugzilla.mozilla.org/show_bug.cgi?id=999886


We could do better. HTTP Code is yet another very specific bit of information.
A question which is very often asked is how to access the HTTP headers from JavaScript without having to go through a round trip of XMLHttpRequest.

http://stackoverflow.com/questions/220231/accessing-the-web-pages-http-headers-in-javascript

I wish indeed that in the DOM there would be a way to access a JSON object with the full HTTP response headers and status line included.

One of the reasons to record the full response instead of having to create an additional request is that some headers are time sensitive and some servers are very sensitive to the type of requests made. For example, some servers will (wrongly) send a different response for headers and/or status line if the HTTP request is made with a GET or a HEAD.




-- 
Karl Dubost 🐄
http://www.la-grange.net/karl/
Received on Monday, 26 May 2014 01:10:59 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:28 UTC