ProAnswers.org

Why we are used setMaxAge() and getMaxAge() in Cookies ?

setMaxAge : Sets the maximum age of the cookie. The cookie will expire after that many seconds have passed. Negative values indicate the default behavior, and will be deleted when the browser closes.

getMaxAge : Returns the maximum specified age of the cookie. If none was specified, a negative value is returned, indicating the default behavior described with setMaxAge.