CookieStore Class
The Cookie Store API of a window (https://cookiestore.spec.whatwg.org/#cookiestore): reads and writes the script-visible cookies of BrowsingContextOptions.CookieJar for the creation URL of the document (which history.pushState() does not change), and fires change events when they change.
public sealed class CookieStore : EventTargetRemarks
The cookies set by this API are Secure. A document without cookie jar has no cookies: the cookies it sets are ignored. The change events are fired for the changes of the jar observable from the document (the cookies of other documents, of the responses, and of document.cookie).
See also
- Inheritance
EventTargetCookieStore
Properties
| Name | Description |
|---|---|
| OnChange | The event handler of the change events (https://cookiestore.spec.whatwg.org/#dom-cookiestore-onchange). |
OnChange
CookieStore.csThe event handler of the change events (https://cookiestore.spec.whatwg.org/#dom-cookiestore-onchange).
Methods
| Name | Description |
|---|---|
| Delete(CookieStoreDeleteOptions) | Deletes a cookie (https://cookiestore.spec.whatwg.org/#dom-cookiestore-delete-options). |
| Delete(string) | Deletes the cookie with the name and the path / (https://cookiestore.spec.whatwg.org/#dom-cookiestore-delete). |
| Get(CookieStoreGetOptions?) | Returns the first script-visible cookie matching the options (https://cookiestore.spec.whatwg.org/#dom-cookiestore-get-options), or null. |
| Get(string) | Returns the first script-visible cookie with the name (https://cookiestore.spec.whatwg.org/#dom-cookiestore-get), or null. |
| GetAll(CookieStoreGetOptions?) | Returns the script-visible cookies matching the options (https://cookiestore.spec.whatwg.org/#dom-cookiestore-getall-options). |
| GetAll(string) | Returns the script-visible cookies with the name (https://cookiestore.spec.whatwg.org/#dom-cookiestore-getall). |
| Set(CookieInit) | Sets a cookie (https://cookiestore.spec.whatwg.org/#dom-cookiestore-set-options). |
| Set(string, string) | Sets a cookie for the path /, Secure and SameSite=Strict (https://cookiestore.spec.whatwg.org/#dom-cookiestore-set). |
Delete overloads
Delete(CookieStoreDeleteOptions)
CookieStore.csDeletes a cookie (https://cookiestore.spec.whatwg.org/#dom-cookiestore-delete-options).
public Task Delete(CookieStoreDeleteOptions options)Delete(string)
CookieStore.csDeletes the cookie with the name and the path / (https://cookiestore.spec.whatwg.org/#dom-cookiestore-delete).
Get overloads
Get(CookieStoreGetOptions?)
CookieStore.csReturns the first script-visible cookie matching the options (https://cookiestore.spec.whatwg.org/#dom-cookiestore-get-options), or null.
public Task<CookieListItem?> Get(CookieStoreGetOptions? options = null)Get(string)
CookieStore.csReturns the first script-visible cookie with the name (https://cookiestore.spec.whatwg.org/#dom-cookiestore-get), or null.
public Task<CookieListItem?> Get(string name)GetAll overloads
GetAll(CookieStoreGetOptions?)
CookieStore.csReturns the script-visible cookies matching the options (https://cookiestore.spec.whatwg.org/#dom-cookiestore-getall-options).
public Task<IReadOnlyList<CookieListItem>> GetAll(CookieStoreGetOptions? options = null)GetAll(string)
CookieStore.csReturns the script-visible cookies with the name (https://cookiestore.spec.whatwg.org/#dom-cookiestore-getall).
public Task<IReadOnlyList<CookieListItem>> GetAll(string name)Set overloads
Set(CookieInit)
CookieStore.csSets a cookie (https://cookiestore.spec.whatwg.org/#dom-cookiestore-set-options).
public Task Set(CookieInit options)