Open Bug 999886 Opened 10 years ago Updated 2 years ago

Unable to get the HTTP status code for the page itself from JavaScript

Categories

(Core :: DOM: Core & HTML, defect, P5)

28 Branch
defect

Tracking

()

UNCONFIRMED

People

(Reporter: michael.heuberger, Unassigned)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:28.0) Gecko/20100101 Firefox/28.0 (Beta/Release)
Build ID: 20140314220517

Steps to reproduce:

While hacking on a single page app, I realized there is no way to read the HTTP headers from the initial page request within JavaScript?!

I really need to know if the initial page request returned with a 200 or 404 or whatever for application-specific reasons.

There are some workaround like https://stackoverflow.com/questions/220231/accessing-the-web-pages-http-headers-in-javascript doing a new XMLHttpRequest() but this is bad performance. I don't want to run a second request just to find this out.

Why can't we access the web page's HTTP Headers in JavaScript right away after the first request? Probably there are historical reasons but it's 2014 now.
Keywords: feature
OS: Mac OS X → All
Hardware: x86 → All
Please propose a spec to either W3C or WHATWG first.
Yeah, I've been thinking of this too. Do you have an URL? And which one would you recommend first, W3C or WHATWG?
Component: Untriaged → DOM
Product: Firefox → Core
Michael, I'd recommend sending mail to whatwg@whatwg.org.
Summary: Unable to get the HTTP status code from JavaScript → Unable to get the HTTP status code for the page itself from JavaScript
Thanks Boris, will do. But I do not want to propose this alone. I need supporters, people who vote for this feature too. The more, the better.

Is there anyone of you wanting this feature too?
Done, emailed to WhatWG - see how it goes!
http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2014-May/296885.html
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Component: DOM → DOM: Core & HTML
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.