Re: [whatwg] HTTP status code from JavaScript

Hi Tobie

I've been thinking about that too before but IMO this is not clean for a
two reasons:
* It is a redundancy. The browser already knows the status code, just
not JavaScript.
* Adding inline JS <script> slows down the page load.

Believe me, I have asked many web developers around the globe, tweeted
about my idea and contacted Mozilla. Everyone thinks this would be a
great addition to JavaScript and there were no objections.

Tell me a good reason why JavaScript should NOT have access to the
status code?

On 25/05/14 19:09, Tobie Langel wrote:
> On May 25, 2014, at 8:59, Michael Heuberger
> <michael.heuberger@binarykitchen.com> wrote:
>
>> Thanks Silvia for your comment but I think we turn in circles.
>>
>> I know you mean it well but this is not the case as I mentioned it over
>> and over again in my previous emails.
>>
>> Let me repeat, the whole SPA of mine is always loaded, no matter if it's
>> a 404 or not so that a nice 404 can be rendered on the client-side. No
>> piece is missing here. To make this work, Javascript needs to be able to
>> have access to the HTTP status code of the initial page load. I can
>> count more reasons or read my previous emails.
>>
>> Something like `window.http.status` would be really awesome.
> Why can't you just set that value server-side (e.g. In a meta tag or
> even using a script tag) and retrieve it on the client? E.g. In pseudo
> PHP:
>
> <script>var http = { status: <?php print response->status php>};</script>
>
> --tobie

-- 

Binary Kitchen
Michael Heuberger
4c Dunbar Road
Mt Eden
Auckland 1024
(New Zealand)

Mobile (text only) ...  +64 21 261 89 81
Email ................  michael@binarykitchen.com
Website ..............  http://www.binarykitchen.com

Received on Sunday, 25 May 2014 07:35:24 UTC