Netscape Cookies (circa 1997)

Here’s a short note I originally published on the web in July 1997. I dredged it up recently because I had forgotten the syntax of the cookie meta element.

Cookies are supported by both Netscape Navigator and Microsoft Internet Explorer. A cookie may be set by a header response directive or an http-equiv meta tag.

Header Directive Format:
Set-Cookie: NAME=VALUE; expires=DATE; path=PATH; domain=DOMAIN_NAME; secure

Meta Tag Format:
<meta http-equiv="Set-Cookie" content="NAME=VALUE; expires=DATE; path=PATH; domain=DOMAIN_NAME; secure">

A more complete description of cookies is available in the following Netscape documents:

Tech Note: Cookies: what they are and how they workTech Note: How to write a server-side CGI program to set and read cookiesSpecification: Client Side State - HTTP Cookies

The GMT string for the first second of January 1, 1970 UTC, as required by the expires attribute, is

Thu, 01-Jan-1970 00:00:01 GMT

This is the beginning of time on Unix and Win32 systems.

Also of interest is RFC 2109, a proposed standard for an “HTTP State Management Mechanism.”

I didn’t explain seven years ago but there is a reason why it’s good to know the “GMT string for the first second of January 1, 1970 UTC.” It’s an arbitrary but consistent value to use for removing cookies.

Update January 2014

Updated Netscape document links to use the Internet Archive Wayback Machine.

RFC 2109 has been obsoleted. See RFC 6265.