PDA

View Full Version : How to use Javascript to get HTTP Header variables?


Surrey
11-20-2002, 06:40 AM
I have some customized HTTP header variables (e.g. HTTP_USERNAME) on the page and would like to know if I can use Javascript to get them.

Thanks...

beetle
11-20-2002, 07:05 AM
nope, unless SSI recognizes them...

for example, getting the user's IP into a js variable

var ip = "<!--#echo var="REMOTE_ADDR"-->";

but all your pages will have to be shtml, and I'm not sure how server support works for SSI....

krycek
11-20-2002, 11:35 AM
...you can do it another way, but I don't know if it is what you are after.

Use PHP or ASP or another server-side language (similar to what beetle said) to either write the variable into a script as the page is built, or store it in a cookie.

::] krycek [::