Namespace: Cookies

Cookies

Source:

Type Definitions

CookieOptions

Type:
  • Object
Properties:
Name Type Attributes Default Description
expires Date | Number <optional>
null

expiry time of the cookie, either a Date object or time in days

max-age Number <optional>
<nullable>
null

max age of the cookie in seconds

path String <optional>
<nullable>
'/'

the cookie path, setting this to "auto" or an empty string defines auto-mode, which targets the current site path, which usually is the default, but we use '/' to set a cookie for while site, this being the common use-case

secure Boolean <optional>
<nullable>
false

define if the cookie should only be transmitted via https (see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#restrict_access_to_cookies)

httponly Boolean <optional>
<nullable>
false

define this, if cookie should only be sent to servers and not be accessible to javascript (see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#restrict_access_to_cookies)

samesite String <optional>
<nullable>
null

define if this cookie should be included in cross-site requests, may be either "strict" (will only ever transmit same-site), "lax" (usual browser default, transmits same-site and top-level GET) or "none" (no restrictions, will always be sent)

Source: