You are viewing extension docs in chrome via the 'file:' scheme: are you expecting to see local changes when you refresh? You'll need run chrome with --allow-file-access-from-files.
paramName
( optional Type array of paramType )
Undocumented.
Description of this parameter from the json schema.

Google Chrome Extensions (Labs)

chrome.experimental.cookies

API reference: chrome.experimental.cookies

Methods

get

void chrome.experimental.cookies.get(, object details, function callback)

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
( Type array of object )
Details to identify the cookie being retrieved.
url
( Type array of string )
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
( Type array of string )
The name of the cookie to retrieve.
storeId
( optional Type array of string )
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
( 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 )
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)

Retrieves all cookies from a single cookie store that match the given information.

Parameters

details
( Type array of object )
Information to filter the cookies being retrieved.
url
( optional Type array of string )
Restricts the retrieved cookies to those that would match the given URL.
name
( optional Type array of string )
Filters the cookies by name.
domain
( optional Type array of string )
Restricts the retrieved cookies to those whose domains match or are subdomains of this one.
path
( optional Type array of string )
Restricts the retrieved cookies to those whose path exactly matches this string.
secure
( optional Type array of boolean )
Filters the cookies by their Secure property.
session
( optional Type array of boolean )
Filters out session vs. persistent cookies.
storeId
( optional Type array of string )
The cookie store to retrieve cookies from. If omitted, the current execution context's cookie store will be used.
callback
( 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
( Type array of Cookie array of paramType paramType )
All the existing, unexpired cookies that match the given cookie info.

getAllCookieStores

void chrome.experimental.cookies.getAllCookieStores(, function callback)

Lists all existing cookie stores.

Parameters

callback
( 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
( Type array of CookieStore array of paramType paramType )
All the existing cookie stores.

remove

void chrome.experimental.cookies.remove(, object details)

Deletes a cookie by name.

Parameters

details
( Type array of object )
Information to identify the cookie to remove.
url
( Type array of string )
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
( Type array of string )
The name of the cookie to remove.
storeId
( optional Type array of string )
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)

Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.

Parameters

details
( Type array of object )
Details about the cookie being set.
url
( Type array of string )
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 )
The name of the cookie. Empty by default if omitted.
value
( optional Type array of string )
The value of the cookie. Empty by default if omitted.
domain
( optional Type array of string )
The domain of the cookie. If omitted, the cookie becomes a host-only cookie.
path
( optional Type array of string )
The path of the cookie. Defaults to the path portion of the url parameter.
secure
( optional Type array of boolean )
Whether the cookie should be marked as Secure. Defaults to false.
httpOnly
( optional Type array of boolean )
Whether the cookie should be marked as HttpOnly. Defaults to false.
expirationDate
( optional Type array of number )
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 )
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) {...});

Fired when a cookie is set or removed.

Parameters

changeInfo
( Type array of object )
Undocumented.
Description of this parameter from the json schema.
removed
( Type array of boolean )
True if a cookie was removed.
cookie
( Cookie array of paramType )
Information about the cookie that was set or removed.

Types

CookieStore

paramName
( Type array of object )
Represents a cookie store in the browser. An incognito mode window, for instance, uses a separate cookie store from a non-incognito window.
id
( Type array of string )
The unique identifier for the cookie store.
tabIds
( Type array of Type array of integer paramType )
Identifiers of all the browser tabs that share this cookie store.

Cookie

paramName
( Type array of object )
Represents information about an HTTP cookie.
name
( Type array of string )
The name of the cookie.
value
( Type array of string )
The value of the cookie.
domain
( Type array of string )
The domain of the cookie (e.g. "www.google.com", "example.com").
hostOnly
( Type array of boolean )
True if the cookie is a host-only cookie (i.e. a request's host must exactly match the domain of the cookie).
path
( Type array of string )
The path of the cookie.
secure
( Type array of boolean )
True if the cookie is marked as Secure (i.e. its scope is limited to secure channels, typically HTTPS).
httpOnly
( Type array of boolean )
True if the cookie is marked as HttpOnly (i.e. the cookie is inaccessible to client-side scripts).
session
( Type array of boolean )
True if the cookie is a session cookie, as opposed to a persistent cookie with an expiration date.
expirationDate
( optional Type array of number )
The expiration date of the cookie as the number of milliseconds since the UNIX epoch. Not provided for session cookies.
storeId
( Type array of string )
The ID of the cookie store containing this cookie, as provided in getAllCookieStores().