chrome.experimental.cookies
API reference: chrome.experimental.cookies
Properties
getLastError
chrome.extensionlastError
Methods
get
void
chrome.experimental.cookies.get(, object
details, function
callback)
Undocumented.
Retrieves information about a single cookie. If more than one cookie of the same name exists for the given URL, the one with the longest domain property will be returned. For cookies with the same domain property length, the one with the longest path length will be returned. If domains and paths are equal, then the cookie with the earliest creation time will be returned.
Parameters
-
details
(
optional
Type
array of
object
)
-
Undocumented.
- Details to identify the cookie being retrieved.
-
-
url
(
optional
Type
array of
string
)
-
Undocumented.
- The URL with which the cookie to retrieve is associated. This argument may be a full URL, in which case any data following the URL path (e.g. the query string) is simply ignored. If host permissions for this URL are not specified in the manifest file, the API call will fail.
-
-
name
(
optional
Type
array of
string
)
-
Undocumented.
- The name of the cookie to retrieve.
-
-
storeId
(
optional
Type
array of
string
)
-
Undocumented.
- The ID of the cookie store in which to look for the cookie. By default, the current execution context's cookie store will be used.
-
-
callback
(
optional
Type
array of
function
)
-
Undocumented.
-
Description of this parameter from the json schema.
-
Returns
Callback function
The callback parameter should specify a function
that looks like this:
If you specify the callback parameter, it should
specify a function that looks like this:
function(Cookie cookie) {...});
-
cookie
(
optional
Cookie
array of
paramType
)
-
Undocumented.
- Contains details about the cookie. This parameter is null if no such cookie was found.
-
getAll
void
chrome.experimental.cookies.getAll(, object
details, function
callback)
Undocumented.
Retrieves all cookies from a single cookie store that match the given information.
Parameters
-
details
(
optional
Type
array of
object
)
-
Undocumented.
- Information to filter the cookies being retrieved.
-
-
url
(
optional
Type
array of
string
)
-
Undocumented.
- Restricts the retrieved cookies to those that would match the given URL.
-
-
name
(
optional
Type
array of
string
)
-
Undocumented.
- Filters the cookies by name.
-
-
domain
(
optional
Type
array of
string
)
-
Undocumented.
- Restricts the retrieved cookies to those whose domains match or are subdomains of this one.
-
-
path
(
optional
Type
array of
string
)
-
Undocumented.
- Restricts the retrieved cookies to those whose path exactly matches this string.
-
-
secure
(
optional
Type
array of
boolean
)
-
Undocumented.
- Filters the cookies by their Secure property.
-
-
session
(
optional
Type
array of
boolean
)
-
Undocumented.
- Filters out session vs. persistent cookies.
-
-
storeId
(
optional
Type
array of
string
)
-
Undocumented.
- The cookie store to retrieve cookies from. If omitted, the current execution context's cookie store will be used.
-
-
callback
(
optional
Type
array of
function
)
-
Undocumented.
-
Description of this parameter from the json schema.
-
Returns
Callback function
The callback parameter should specify a function
that looks like this:
If you specify the callback parameter, it should
specify a function that looks like this:
function(array of Cookie cookies) {...});
-
cookies
(
optional
Type
array of
Cookie
array of
paramType
paramType
)
-
Undocumented.
- All the existing, unexpired cookies that match the given cookie info.
-
getAllCookieStores
void
chrome.experimental.cookies.getAllCookieStores(, function
callback)
Undocumented.
Lists all existing cookie stores.
Parameters
-
callback
(
optional
Type
array of
function
)
-
Undocumented.
-
Description of this parameter from the json schema.
-
Returns
Callback function
The callback parameter should specify a function
that looks like this:
If you specify the callback parameter, it should
specify a function that looks like this:
function(array of CookieStore cookieStores) {...});
-
cookieStores
-
Undocumented.
- All the existing cookie stores.
-
remove
void
chrome.experimental.cookies.remove(, object
details)
Undocumented.
Deletes a cookie by name.
Parameters
-
details
(
optional
Type
array of
object
)
-
Undocumented.
- Information to identify the cookie to remove.
-
-
url
(
optional
Type
array of
string
)
-
Undocumented.
- The URL associated with the cookie. If host permissions for this URL are not specified in the manifest file, the API call will fail.
-
-
name
(
optional
Type
array of
string
)
-
Undocumented.
- The name of the cookie to remove.
-
-
storeId
(
optional
Type
array of
string
)
-
Undocumented.
- The ID of the cookie store to look in for the cookie. If unspecified, the cookie is looked for by default in the current execution context's cookie store.
-
Returns
Callback function
The callback parameter should specify a function
that looks like this:
If you specify the callback parameter, it should
specify a function that looks like this:
function(Type param1, Type param2) {...});
set
void
chrome.experimental.cookies.set(, object
details)
Undocumented.
Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.
Parameters
-
details
(
optional
Type
array of
object
)
-
Undocumented.
- Details about the cookie being set.
-
-
url
(
optional
Type
array of
string
)
-
Undocumented.
- The request-URI to associate with the setting of the cookie. This value can affect the default domain and path values of the created cookie. If host permissions for this URL are not specified in the manifest file, the API call will fail.
-
-
name
(
optional
Type
array of
string
)
-
Undocumented.
- The name of the cookie. Empty by default if omitted.
-
-
value
(
optional
Type
array of
string
)
-
Undocumented.
- The value of the cookie. Empty by default if omitted.
-
-
domain
(
optional
Type
array of
string
)
-
Undocumented.
- The domain of the cookie. If omitted, the cookie becomes a host-only cookie.
-
-
path
(
optional
Type
array of
string
)
-
Undocumented.
- The path of the cookie. Defaults to the path portion of the url parameter.
-
-
secure
(
optional
Type
array of
boolean
)
-
Undocumented.
- Whether the cookie should be marked as Secure. Defaults to false.
-
-
httpOnly
(
optional
Type
array of
boolean
)
-
Undocumented.
- Whether the cookie should be marked as HttpOnly. Defaults to false.
-
-
expirationDate
(
optional
Type
array of
number
)
-
Undocumented.
- The expiration date of the cookie as the number of milliseconds since the UNIX epoch. If omitted, the cookie becomes a session cookie.
-
-
storeId
(
optional
Type
array of
string
)
-
Undocumented.
- The ID of the cookie store in which to set the cookie. By default, the cookie is set in the current execution context's cookie store.
-
Returns
Callback function
The callback parameter should specify a function
that looks like this:
If you specify the callback parameter, it should
specify a function that looks like this:
function(Type param1, Type param2) {...});
Events
onChanged
chrome.experimental.cookies.onChanged.addListener(function(object changeInfo) {...});
Undocumented.
Fired when a cookie is set or removed.
Parameters
-
changeInfo
(
optional
Type
array of
object
)
-
Undocumented.
-
Description of this parameter from the json schema.
-
-
removed
(
optional
Type
array of
boolean
)
-
Undocumented.
- True if a cookie was removed.
-
-
cookie
(
optional
Cookie
array of
paramType
)
-
Undocumented.
- Information about the cookie that was set or removed.
-
Types
CookieStore
paramName
(
optional
Type
array of
object
)
Undocumented.
Represents a cookie store in the browser. An incognito mode window, for instance, uses a separate cookie store from a non-incognito window.
-
id
(
optional
Type
array of
string
)
-
Undocumented.
- The unique identifier for the cookie store.
-
-
tabIds
(
optional
Type
array of
Type
array of
integer
paramType
)
-
Undocumented.
- Identifiers of all the browser tabs that share this cookie store.
-
Cookie
paramName
(
optional
Type
array of
object
)
Undocumented.
Represents information about an HTTP cookie.
-
name
(
optional
Type
array of
string
)
-
Undocumented.
- The name of the cookie.
-
-
value
(
optional
Type
array of
string
)
-
Undocumented.
- The value of the cookie.
-
-
domain
(
optional
Type
array of
string
)
-
Undocumented.
- The domain of the cookie (e.g. "www.google.com", "example.com").
-
-
hostOnly
(
optional
Type
array of
boolean
)
-
Undocumented.
- True if the cookie is a host-only cookie (i.e. a request's host must exactly match the domain of the cookie).
-
-
path
(
optional
Type
array of
string
)
-
Undocumented.
- The path of the cookie.
-
-
secure
(
optional
Type
array of
boolean
)
-
Undocumented.
- True if the cookie is marked as Secure (i.e. its scope is limited to secure channels, typically HTTPS).
-
-
httpOnly
(
optional
Type
array of
boolean
)
-
Undocumented.
- True if the cookie is marked as HttpOnly (i.e. the cookie is inaccessible to client-side scripts).
-
-
session
(
optional
Type
array of
boolean
)
-
Undocumented.
- True if the cookie is a session cookie, as opposed to a persistent cookie with an expiration date.
-
-
expirationDate
(
optional
Type
array of
number
)
-
Undocumented.
- The expiration date of the cookie as the number of milliseconds since the UNIX epoch. Not provided for session cookies.
-
-
storeId
(
optional
Type
array of
string
)
-
Undocumented.
- The ID of the cookie store containing this cookie, as provided in getAllCookieStores().
-