Connecting Tech Pros Worldwide Help | Site Map

Accessing http header in javascript

  #1  
Old July 18th, 2006, 08:45 PM
mngibson@gmail.com
Guest
 
Posts: 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

  #2  
Old July 18th, 2006, 11:05 PM
bobzimuta
Guest
 
Posts: n/a

re: Accessing http header in javascript


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

mngibson@gmail.com wrote:
Quote:
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
  #3  
Old July 19th, 2006, 06:25 PM
Dr John Stockton
Guest
 
Posts: n/a

re: Accessing http header in javascript


JRS: In article <1153251893.438945.181900@b28g2000cwb.googlegroups .com>
, dated Tue, 18 Jul 2006 12:44:53 remote, seen in
news:comp.lang.javascript, mngibson@gmail.com posted :
Quote:
>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.
Closed Thread