Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: JavaScript
Expertise: Beginner
Nov 3, 1999

Access CGI Environment Variables

Question:
Can JavaScript access CGI environment variables? Once a user has logged into my site, I would like to retrieve the user name from the "REMOTE_USER" variable.

Answer:
No, there is no straightforward way to make this happen because JavaScript runs within your browser on the client, whereas CGI scripts (and environment variables) are on the server. The only way to accomplish what you're after is to use your CGI script to dynamically output the values of the CGI variables you're interested in when creating your HTML page. You can use CGI to save the environment variables into hidden form variables or even generate client-side JavaScript dynamically. But, either way, this is not quick and easy.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date