473,379 Members | 1,201 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Read HTTP Headers with Javascript???

Can I do this? If I'm passing info in my HTTP headers, can I read this info
via Javascript? I've seen some hope out there, but nothing definitive - I'm
hoping to get that answer here....

TIA
Rick


Jul 20 '05 #1
3 68722
Rick Edwards wrote:
Can I do this? If I'm passing info in my HTTP headers, can I read this info
via Javascript? I've seen some hope out there, but nothing definitive - I'm
hoping to get that answer here....

TIA
Rick


It's one of those ... weeeellll, sort-of... kinds of things.
Which headers? Those sent with a request or those received with a response?

Javascript, per se, cannot do this. But (here's the "sort-of") see

Request: (watch for wrapping long url)
(using php; similar could be done with asp)
http://groups.google.com/groups?q=va...68.3.44&rnum=1

(using server-side includes)
http://groups.google.com/groups?hl=e...168.3.44#link9
Response: (watch for wrapping long url)
http://groups.google.com/groups?hl=e...ang.javascript
google for "HTTP Headers" in the comp.lang.javascript group

Regards,
Stephen

Jul 20 '05 #2

"Rick Edwards" <ri***@NOSPAMsasktel.net> wrote :
Can I do this? If I'm passing info in my HTTP headers, can I read this info via Javascript? I've seen some hope out there, but nothing definitive - I'm hoping to get that answer here....


For IE (5+,don't remember exactly) you can use
XMLHttpRequest object ->getAllResponseHeaders method

HTH.
Jul 20 '05 #3


Rick Edwards wrote:
Can I do this? If I'm passing info in my HTTP headers, can I read this info
via Javascript? I've seen some hope out there, but nothing definitive - I'm
hoping to get that answer here....


Cookies are sent as HTTP headers and JavaScript provides access to
cookies per
document.cookie
Some selected HTTP header information is also made accessible by
JavaScript for instance
document.characterSet
in Netscape and
document.charset
in IE.
In general however if your server sends a HTTP response to the browser
that is rendered inside of a window then JavaScript doesn't provide
access to HTTP response headers.
The only way you get access to such headers is if you use XMLHttpRequest
to send and receive a HTTP request

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Shelly | last post by:
hi, I am trying to create a custom HTTP header and trying to access that variable on another ASP.NET webpage. Following is the code base- I use the following code to set the header...
6
by: Sam | last post by:
I have some issues with HTTP Headers and I was hoping for some pointers or references to good articles. Here is the problem. I have 6 .aspx pages, each page contains a common .ascx. This ascx...
8
by: Andreas Klemt | last post by:
Hello, I get this error Message "cannot redirect after http headers have been sent" when I do this response.redirect ("home.aspx") How can I find out with vb.net if already a http header has...
1
by: Ale News | last post by:
Hi to All.. I must add some custom headers HTTP and then i would to read them.. I used the AppendHeader Method to add my headers but when i try to read the headers i can't see my custom ones.....
4
by: Purushottam Khandebharad | last post by:
Hi all, I need to pass HTTP Headers from onw web site to another web site as I need to post a form on one web applications page to page on different web site both sites are under my control,...
2
by: sagar | last post by:
Hello Friends, I was working with Gdata to access the data in my google calander. I want to do this with a simple HTML-JS page, no server side scripting (hitherto dont know if this is...
2
by: jethro_uk | last post by:
Hi Guys, I have a problem, and I would be grateful for any help. My WebApp has to do some database work in page1.ASP Because this may take a few second, before Page1 connects to the database,...
5
by: Milos Prudek | last post by:
I perform a XML-RPC call by calling xmlrpclibBasicAuth which in turn calls xmlrpclib. This call of course sends a HTTP request with correct HTTP headers. The response is correctly parsed by...
5
by: gibble | last post by:
Hi, I am going crazy. We get a hundred or so of these errors each day and while the fix would seem obvious, the error does not include a line number! -------------------- Process...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.