Re: [whatwg] HTTP status code from JavaScript

Hi again,

On May 25, 2014, at 9:35, Michael Heuberger
<michael.heuberger@binarykitchen.com> wrote:

> * It is a redundancy. The browser already knows the status code, just
> not JavaScript.

That argument can equally well be used the other way round: it's a
redundancy to expose in JS something that be easily exposed by the
server.

> * Adding inline JS <script> slows down the page load.

In that case, use a meta tag:

<meta name=http-status content=404>

Then in JS:

var status = parseInt(document.querySelector("meta[name=http-status]").getAttribute("content"));

Should this pattern become pervasive, it might bathe sense to
standardize it and expose it in JS. Frankly, though, it's the first
time I hear of such a request.

--tobie

Received on Sunday, 25 May 2014 07:58:31 UTC