Connecting Tech Pros Worldwide Help | Site Map

Accessing http header in javascript

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 18th, 2006, 07:45 PM
mngibson@gmail.com
Guest
 
Posts: n/a
Default Accessing http header in javascript

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, 10:05 PM
bobzimuta
Guest
 
Posts: n/a
Default 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, 05:25 PM
Dr John Stockton
Guest
 
Posts: n/a
Default 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.
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.