Setting a cookie value to an empty string effectively destroys the cookie data, but does not eliminate the cookie itself. To get rid of a cookie, the expiration date must be set to some point in the past. Since the UNIX time measuring starts on January 1, 1970, a date somewhere close to this point is recommended. The preceding code (see deletecookie.html) uses Christmas 1980 as the cookie expiration date. The web browser sees that this date lies in the past (unless the user changed the local time settings) and deletes the cookie. Once again, it is important that the same cookie features are used as when the cookie was set. |