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.

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

BCD tables only load in the browser

Example extensions

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