| home / programming / javascript / cookies |
|
|
Making the Most from the Drudgery of OthersHow they workWhen you click on a link or otherwise access a URL, your browser sends a request for the file in an HTTP header (that you don't see) to the server that looks something like this: Content-type: text/html This lets the server know what type of document that is being requested by the browser. If this is your first visit, or have no cookie yet, the HTTP header request contains no cookie information. Then, the server sends back an HTTP response header to you instructing the browser to create a cookie file on your hard drive (if there is a script to put one there). That looks something like this: Content-type: text/html If you have a cookie for that site or URL already, the cookie info is sent along with the HTTP header request initially, then the server knows you have a cookie for that URL. Then the cookie info is used by a CGI program, or JavaScript. In Summary, it's this simple:
Cookies store data in name and value pairs. The name and value can be composed of whatever you wish. An example would be MyCar=Junker. The complete list of cookie parameters that can be used to specify a cookie are (Ladd & O'Donnell, 1999) : name=value; A JavaScript that you write or use can utilize whatever name/value pairs that you want to accomplish your task. | ||||||||||||||||||||||||
| To Continue, Use The Arrow Buttons |
|
Comments are
welcome
Produced by Greg Meckes
Created: Jan. 12, 2000
Revised: Jan. 12, 2000
URL: http://webreference.com/programming/javascript/cookies/