JSResCookie


A ResCookie represents a response cookie. When read as a string it returns the full Cookie (as it appears in the Set-Cookie header):

CookieName=Cookie Value; path=/somepath; domain=some.host.com; secure

It may also be assigned to as a string; in which case it will be parsed as if it were the value of a Set-Cookie header.

Properties

name

The cookie name.

value

The cookie value.

expires

The cookie expiration time. This can be null. When read, it returns a Date object. When written, it accepts a Date object, a number (which will be interpreted as the number of milliseconds since Jan 1, 1970 GMT) or a string (which should be a standard representation of a date in the GMT timezone). Setting this property to null means the cookie will have session scope.

path

The cookie path.

domain

The cookie domain.

secure

A boolean value specifying whether the cookie is secure (i.e. should only be sent over secure connections).

Example

// Set the cookie value
cookie.value = "New value";
// Set the cookie expiration date
cookie.expires = "Wednesday, 09-Nov-02 23:12:40 GMT";
// Set the entire cookie
cookie = "New-Name=New value;
path=/; domain=some.host.com";