Cookie

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Cookie 是 HTTP 請求標頭,它的值包含由伺服器設定的 HTTP cookies (透過 Set-Cookie 標頭設定,或者透過 Javascript 的 Document.cookie 設定)。

Cookie 標頭不是必要的,比如瀏覽器可能會因為隱私設定而直接省略 Cookie 不傳。

Header type Request header
Forbidden header name yes

Syntax

http
Cookie: <cookie-list>
Cookie: name=value
Cookie: name=value; name2=value2; name3=value3

一連串名值對(name-value pair),格式為: <cookie-name>=<cookie-value>。每對之間由一個分號與一個空白分隔('; ')。

範例

Cookie: PHPSESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1

Specifications

Specification
HTTP State Management Mechanism
# cookie

Browser compatibility

BCD tables only load in the browser

See also