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

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Cookie

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

See also