Bottom of This Page |
Saving and Restoring Document JScript Cookie Information
If you made a mistake or if you had selected the
"Cancel" button or if you didn't enter anything when
you were asked to "Enter your first name" then you
can correct it, by choosing
Change Your Guest Name
(dialogue only accessible in English). /
Hvis man begik en fejl, eller hvis man har valgt
"Annuller"
Use of cookies / Brug af cookies
- or use the button below! / - eller brug knappen nedenfor!
- or use one of these graphics buttons below! / - eller brug en af disse grafiske knapper nedenfor!
Tip Text 1: / Tip tekst 1: Modify / Ændre (forandre) [Modify / Aendre (forandre)]
Tip Text 2: / Tip tekst 2: Correct / Ret
Tip Text 3: / Tip tekst 3: Edit / Rediger
Tip Text 4: / Tip tekst 4: Change / Skift
Property. String value of a cookie, which is a small piece of information stored by the Navigator in the cookies.txt
file.
document.cookie
document
Navigator 2.0
Yes
Use string methods such as substring, charAt, indexOf, and lastIndexOf to determine the value stored in the cookie. See the Appendix D, "Netscape cookies" for a complete specification of the cookie syntax.
You can set the cookie property at any time.
The "expires="
component in the cookie file sets an expiration date for the cookie, so it persists beyond the current browser session. This date string is formatted as follows:
Wdy, DD-Mon-YY HH:MM:SS GMT
This format represents the following values:
For example, a valid cookie expiration date is
expires=Wednesday, 09-Nov-99 23:12:40 GMT
The cookie date format is the same as the date returned by toGMTString, with the following exceptions:
function RecordReminder(time, expression) {
// Record a cookie of the form "@<T>=<E>" to map
// from <T> in milliseconds since the epoch,
// returned by Date.getTime(), onto an encoded expression,
// <E> (encoded to contain no white space, semicolon,
// or comma characters)
document.cookie = "@" + time + "=" + expression + ";"
// set the cookie expiration time to one day
// beyond the reminder time
document.cookie += "expires=" + cookieDate(time + 24*60*60*1000)
// cookieDate is a function that formats the date
// according to the cookie spec
}
Conventions used for: Source code syntax highlighting. / Regler brugt til: Kildekode syntaks fremhævning.
expires=DATE
The expires attribute specifies a date string that defines the valid life time of that cookie. Once the expiration date has been reached, the cookie will no longer be stored or given out.
The date string is formatted as:
Wdy, DD-Mon-YYYY HH:MM:SS GMT
This is based on RFC 822, RFC 850, RFC 1036, and RFC 1123, with the variations that the only legal time zone is GMT and the separators between the elements of the date must be dashes.
expires is an optional attribute. If not specified, the cookie will expire when the user's session ends.
Note: There is a bug in Netscape Navigator version 1.1 and earlier. Only cookies whose path attribute is set explicitly to "/" will be properly saved between sessions if they have an expires attribute.
Use of cookies / Brug af cookies
|