By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,288 Members | 1,695 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,288 IT Pros & Developers. It's quick & easy.

Accessing http header in javascript

P: n/a
Is there any way to access arbitrary http header information through
javascript? For example, if I wanted to obtain content-length? I
suspect not, but I'm not too knowledgable on js.

Thanks,
Mark

Jul 18 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
If absolutely necessary, and the browser has XMLHttpRequest support,
you could send out a request for the same page again (note that's an
extra server request). You'll get all the response headers, via the
XMLHttpRequest->getAllResponseHeaders() or
XMLHttpRequest->getResponseHeader("headername") functions

Reference:
http://www.w3schools.com/dom/dom_http.asp

mn******@gmail.com wrote:
Is there any way to access arbitrary http header information through
javascript? For example, if I wanted to obtain content-length? I
suspect not, but I'm not too knowledgable on js.

Thanks,
Mark
Jul 18 '06 #2

P: n/a
JRS: In article <11**********************@b28g2000cwb.googlegroups .com>
, dated Tue, 18 Jul 2006 12:44:53 remote, seen in
news:comp.lang.javascript, mn******@gmail.com posted :
>Is there any way to access arbitrary http header information through
javascript? For example, if I wanted to obtain content-length? I
suspect not, but I'm not too knowledgable on js.
<FAQENTRY>

Header information is important, and ISTM that it would be useful to be
able to find out about how to access it, starting by reading the FAQ -
so a suitable link would do.

I see three possibilities worth presenting :
code for using XMLHttpRequest;
a utility program which, given a URL,
will fetch the header material;
Telnet code
but there may be more.

--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4
<URL:http://www.jibbering.com/faq/>? JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 19 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.