Позволяет WebExtensions получить и установить куки ,а также сообщить об их изменении.
Для использования этого 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
.
- Read a non-secure cookie for
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
.
- Read a non-secure cookie for
*://*.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.
- Read or write a secure or non-secure cookie for
Browser compatibility
BCD tables only load in the browser
Edge incompatibilities
Promises are not supported in Edge. Use callbacks instead.
Example extensions
This API is based on Chromium's chrome.cookies
API. This documentation is derived from cookies.json
in the Chromium code.
Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.