View Full Version : Getting Environment Variables

07-01-2004, 12:02 AM
I have a Javascript program which I would like to read the environment variables set in the servers .cshrc file. What I am trying to do is set the href using the environment variables. For example, instead of putting http:\\... and typing out the whole url in the code, I would like to read the $PROJECT_DIR and $PROJECT_VER environment variables from the server to set the href. Is there a way to do this with Javascript? I am currently running Redhat Linux Enterprise WS.

07-01-2004, 12:11 AM
The nature of JavaScript means it's completely client side, run on the user's end after the page has already reached his/her browser. If you think about that then, there is no way for JavaScript to access environmental variables on your server- PHP or CGI for example is needed. :) You can use PHP for example to first retrieve the value you need, then dynamically write out a Javascript with a variable containing this value. But that's different than using JavaScript to actually retrieve the value you need.

07-01-2004, 12:17 AM
Thanks George. I was hoping for a 'down-and-dirty' way of doing this. I am new to Javascript and still learning every day. :confused:

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum