Basic HTML version of Foils prepared 11 March 99

Foil 4 Cookies - "hidden" alternative

From Overview of JavaScript II -- From Cookies to Dynamical HTML CPS616 Technologies of the Information Age -- Spring Semester 99. by Geoffrey C. Fox (Tom Scavo)


Cookies were introduced by Netscape to preserve client side state
If you have a CGI script that services several clients (ordering T Shirts perhaps), it is neatest to use client and not server to store information such as name of user, passwords etc.
Traditionally saved state in forms for a session preserved using "hidden" fields
  • <INPUT type=hidden" name="username" value="" >
  • set by formname.username.value = WHATHAVEYOU;
Such hidden fields are passed to CGI scripts in same fashion as other variables set in form text fields
hidden values can either by set by JavaScript on client side or returned built into a page constructed by CGI script which might read N values and return a new form with M new fields for client to fill in and N old entries preserved in hidden fields
So hidden variables are nice but only preserved as long as you keep to page you started with or that returned by CGI script.



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Thu Mar 11 1999