Since HTTP is a stateless protocol, CGIs have to do extra work in order to remember
information about previous access. One way of maintaining state information is to
use client cookies stored on the user's browser. When the browser calls the
CGI VI, it sends all client cookies previously stored by the CGI. When the CGI returns
a reply, it can add information to the client cookies. Note that some older browsers
do not have support for client cookies.
The following CGI will use the client cookies text and bgcolor
to customize a document's text and background color based on the values stored in
these cookies.
To specify which colors to use, call the CGI with the following parameters:
set&text=textColor&bgcolor=backGroundColor parameters
The CGI will store the specified colors in your browser's cookie file. The cookies will expire in two weeks (as specified in Set Color Cookies.vi).
To use the CGI to return an HTML document with the specified colors, call the CGI and append the path to the document to the URL. The CGI will use the PATH_INFO environmental variable to read the specified document.
- /cgi-bin/examples/colors.vi/examples/plain.htm
- Uses the colors.vi CGI to process the /examples/plain.htm page.
- /cgi-bin/examples/colors.vi/indexcgi.htm
- Uses the colors.vi CGI to process the default example document /indexcgi.htm. Note that all relative links to local HTML documents from this page will also be processed by the colors.vi CGI.