cookies

Позволяет расширениям получать и устанавливать куки, а также сообщать об их изменении.

Для использования этого API,вам нужно предоставить доступ API permission в вашем файле manifest.json,а также host permissions для тех сайтов чьи куки вам нужны для доступа.Смотрите cookie Permissions.

Types

cookies.Cookie

Предоставляет информацию о HTTP cookie

cookies.CookieStore

Represents a cookie store in the browser.

cookies.OnChangedCause

Represents the reason a cookie changed.

Methods

cookies.get()

Запрашивает информацию об одном кукис.

cookies.getAll()

Выдаёт все кукис которые подходят установленному фильтру.

cookies.set()

Устанавливает кукис с заданной информацией;в том случае если подобный кукис был информация будет перезаписана.

cookies.remove()

Удаляет кукис по имени.

cookies.getAllCookieStores()

Список всех существующих куки

Event handlers

cookies.onChanged

Происходит когда кукис задаётся или меняется.

Permissions

In order to use this API, an add-on must specify the "cookies" API permission in its manifest, along with host permissions for any sites for which it wishes to access cookies. The add-on may read or write any cookies which could be read or written by a URL matching the host permissions. For example:

http://*.example.com/

An add-on with this host permission may:

  • Read a non-secure cookie for www.example.com, with any path.
  • Write a secure or non-secure cookie for www.example.com, with any path.

It may not:

  • Read a secure cookie for www.example.com.
http://www.example.com/

An add-on with this host permission may:

  • Read a non-secure cookie for www.example.com, with any path.
  • Read a non-secure cookie for .example.com, with any path.
  • Write a secure or non-secure cookie for www.example.com with any path.
  • Write a secure or non-secure cookie for .example.com with any path.

It may not:

  • Read or write a cookie for foo.example.com.
  • Read or write a cookie for foo.www.example.com.
*://*.example.com/

An add-on with this host permission may:

  • Read or write a secure or non-secure cookie for www.example.com with any path.

Совместимость с браузерами

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Firefox for Android
Safari on iOS
Cookie
Cookie.firstPartyDomain
Cookie.partitionKey
Cookie.sameSite
CookieStore
CookieStore.id
CookieStore.incognito
CookieStore.tabIds
OnChangedCause
get
get.firstPartyDomain
get.partitionKey
getAll
getAll.firstPartyDomain
getAll.partitionKey
getAllCookieStores
onChanged
onChanged.partitionKey
remove
remove.firstPartyDomain
remove.partitionKey
sameSiteStatus
sameSiteStatus.lax
sameSiteStatus.no_restriction
sameSiteStatus.strict
sameSiteStatus.unspecified
set
set.firstPartyDomain
set.partitionKey
set.sameSite

Legend

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

Full support
Full support
Partial support
Partial support
No support
No support
See implementation notes.
Has more compatibility info.

Example extensions

Примечание: Этот API основан на Chromium API chrome.cookies. Эта документация основана на cookies.json из кода Chromium.