The lifetime of a cookie is defined with this attribute. From JavaScript, you can set this attribute but you cannot read it since there is no real object model for the cookies.
To define this attribute, you add a name-value pair to the cookie definition string whose name is "expires" and whose value is defined according to the Date.toGMTString() method.
A cookie only survives for the duration of the page in the browser unless you define an expiry date for it. If the expiry date is in the future when the browser exits, they will be remembered in a persistent cache inside the browser. If not, the cookie is discarded and unavailable next time you run the browser.
See also: | Date.toGMTString() |
Prev | Home | Next |
Cookie domain | Up | Cookie path |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |