You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Specifies a function that will be used to encode a cookie's value. Since value of a cookie
67
-
has a limited character set (and must be a simple string), this function can be used to encode
68
-
a value into a string suited for a cookie's value.
64
+
Specifies a function that will be used to encode a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1).
65
+
Since value of a cookie has a limited character set (and must be a simple string), this function can be used to encode
66
+
a value into a string suited for a cookie's value, and should mirror `decode` when parsing.
69
67
70
-
The default function is the global `encodeURIComponent`, which will encode a JavaScript string
71
-
into UTF-8 byte sequences and then URL-encode any that fall outside of the cookie range.
68
+
The default function is the global `encodeURIComponent`.
72
69
73
70
##### maxAge
74
71
75
72
Specifies the `number` (in seconds) to be the value for the [`Max-Age``Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.2).
76
-
The given number will be converted to an integer by rounding down. By default, no maximum age is set.
77
73
78
74
The [cookie storage model specification](https://tools.ietf.org/html/rfc6265#section-5.3) states that if both `expires` and
79
75
`maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this,
@@ -82,8 +78,7 @@ so if both are set, they should point to the same date and time.
82
78
##### expires
83
79
84
80
Specifies the `Date` object to be the value for the [`Expires``Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.1).
85
-
By default, no expiration is set, and most clients will consider this a "non-persistent cookie" and
86
-
will delete it on a condition like exiting a web browser application.
81
+
When no expiration is set clients consider this a "non-persistent cookie" and delete it the current session is over.
87
82
88
83
The [cookie storage model specification](https://tools.ietf.org/html/rfc6265#section-5.3) states that if both `expires` and
89
84
`maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this,
@@ -92,49 +87,41 @@ so if both are set, they should point to the same date and time.
92
87
##### domain
93
88
94
89
Specifies the value for the [`Domain``Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.3).
95
-
By default, no domain is set, and most clients will consider the cookie to apply to only the current domain.
90
+
When no domain is setclients consider the cookie to apply to the current domain only.
96
91
97
92
##### path
98
93
99
-
Specifies the value for the [`Path``Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.4). By default, the path
100
-
is considered the ["default path"](https://tools.ietf.org/html/rfc6265#section-5.1.4).
94
+
Specifies the value for the [`Path``Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.4).
95
+
When no path is set, the path is considered the ["default path"](https://tools.ietf.org/html/rfc6265#section-5.1.4).
101
96
102
97
##### httpOnly
103
98
104
-
Specifies the `boolean` value for the [`HttpOnly``Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.6). When truthy,
105
-
the `HttpOnly` attribute is set, otherwise it is not. By default, the `HttpOnly` attribute is not set.
106
-
107
-
Be careful when setting this to `true`, as compliant clients will not allow client-side
108
-
JavaScript to see the cookie in `document.cookie`.
99
+
Enables the [`HttpOnly``Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.6).
100
+
When enabled, clients will not allow client-side JavaScript to see the cookie in `document.cookie`.
109
101
110
102
##### secure
111
103
112
-
Specifies the `boolean` value for the [`Secure``Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.5). When truthy,
113
-
the `Secure` attribute is set, otherwise it is not. By default, the `Secure` attribute is not set.
114
-
115
-
Be careful when setting this to `true`, as compliant clients will not send the cookie back to
116
-
the server in the future if the browser does not have an HTTPS connection.
104
+
Enables the [`Secure``Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.5).
105
+
When enabled, clients will only send the cookie back if the browser has a HTTPS connection.
117
106
118
107
##### partitioned
119
108
120
-
Specifies the `boolean` value for the [`Partitioned``Set-Cookie`](https://tools.ietf.org/html/draft-cutler-httpbis-partitioned-cookies/)
121
-
attribute. When truthy, the `Partitioned` attribute is set, otherwise it is not. By default, the
122
-
`Partitioned` attribute is not set.
109
+
Enables the [`Partitioned``Set-Cookie` attribute](https://tools.ietf.org/html/draft-cutler-httpbis-partitioned-cookies/).
110
+
When enabled, clients will only send the cookie back when the current domain _and_ top-level domain matches.
123
111
124
112
This is an attribute that has not yet been fully standardized, and may change in the future.
125
-
This also means many clients may ignore this attribute until they understand it. More information
113
+
This also means clients may ignore this attribute until they understand it. More information
126
114
about can be found in [the proposal](https://github.com/privacycg/CHIPS).
127
115
128
116
##### priority
129
117
130
-
Specifies the `string` to be the value for the [`Priority``Set-Cookie` attribute](https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1).
118
+
Specifies the value for the [`Priority``Set-Cookie` attribute](https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1).
131
119
132
120
-`'low'` will set the `Priority` attribute to `Low`.
133
121
-`'medium'` will set the `Priority` attribute to `Medium`, the default priority when not set.
134
122
-`'high'` will set the `Priority` attribute to `High`.
135
123
136
-
More information about the different priority levels can be found in
More information about enforcement levels can be found in [the specification](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7).
* More information about enforcement levels can be found in [the specification](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7).
0 commit comments