Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jun 2004
    Location
    New Hampshire
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Getting Environment Variables

    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.

  • #2
    WA
    WA is offline
    Administrator
    Join Date
    Mar 2002
    Posts
    2,596
    Thanks
    2
    Thanked 19 Times in 18 Posts
    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.
    - George
    - JavaScript Kit- JavaScript tutorials and 400+ scripts!
    - JavaScript Reference- JavaScript reference you can relate to.

  • #3
    New to the CF scene
    Join Date
    Jun 2004
    Location
    New Hampshire
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks George. I was hoping for a 'down-and-dirty' way of doing this. I am new to Javascript and still learning every day.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •