Re: [whatwg] HTTP status code from JavaScript

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