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 请求标头,其中含有先前由服务器通过 Set-Cookie 标头投放或通过 JavaScript 的 Document.cookie 方法设置,然后存储到客户端的 HTTP cookie

这个标头是可选的,而且可能会被忽略,例如在浏览器的隐私设置里面设置为禁用 cookie。

标头类型 请求标头
禁止修改的标头

语法

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

一系列的名称/值对,形式为 <cookie-name>=<cookie-value>。名称/值对之间用分号和空格('; ')隔开。

示例

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

规范

Specification
HTTP State Management Mechanism
# cookie

浏览器兼容性

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

参见