Skip to main content

cookie

The cookie object provides functions for creating, retrieving, or removing site cookies.

Methods

get

pb.cookie.get(cookieKey)

Retrieves the cookie information for a single cookie

Returns: string - Returns the cookie value specified by the key.

ParamTypeDescription
cookieKeystringThe key that identifies the cookie information to be retrieved.

set

pb.cookie.set(cookieKey, value, [options])

Sets the information for a single cookie, or creates a new cookie.

Returns: string - Returns the cookie that was set.

ParamTypeDefaultDescription
cookieKeystringThe key that identifies the cookie information to be retrieved.
valuestringThe value to which to set this cookie.
[options]ObjectAdditional options:
[options.expires]String | Number | DateMust be either the string 'never', a number of days, or a JavaScript Date object.
[options.path]stringThe cookie's path.
[options.domain]stringThe cookie's domain.
[options.secure]BooleanfalseTrue means the cookie will be marked 'secure'.

remove

pb.cookie.remove(key)

Remove a cookie

ParamTypeDescription
keystringThe key that identifies the cookie to be removed.