Getting values from JavaScript to CGI Bin program

  • Thread starter Rajan Vijayaraghavan
  • Start date
R

Rajan Vijayaraghavan

Hi,
I have a question with the JavaScript and CGI. This is the
scenario.
Say, a user is coming to page 'X'. The page 'X' is completely
generated by a cgi bin program. The cgi-bin program is in C. The page
'X' has JavaScript code to set and read cookies. When I generate the
page 'X', is there a way I can get the cookie value (a counter say)
into some variable in the Cgi program ? Based on the counter, i want
to the cgi to display different page. Is this possible ?


Rajan
 
M

Martin Honnen

Rajan said:
Hi,
I have a question with the JavaScript and CGI. This is the
scenario.
Say, a user is coming to page 'X'. The page 'X' is completely
generated by a cgi bin program. The cgi-bin program is in C. The page
'X' has JavaScript code to set and read cookies. When I generate the
page 'X', is there a way I can get the cookie value (a counter say)
into some variable in the Cgi program ? Based on the counter, i want
to the cgi to display different page. Is this possible ?

Sequence of actions:
browser sends HTTP request
server executes CGI to answer request
browser receives request and executes client side JavaScript to set
cookie

therefore the CGI cannot know the cookies the JavaScript sets later.
In general cookies are sent as HTTP headers, thus to check for cookies
you need to find out how your CGI can read HTTP headers. Ask in a group
about CGI programming
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,079
Messages
2,570,574
Members
47,206
Latest member
Zenden

Latest Threads

Top