javascriptgoogle-chromecookiesgoogle-chrome-extensioncookiestore

How can I access CookieStore with a Chrome Extension?


I am trying to build a Chrome extension that will allow a user simultaneous cookie sessions. In theory, this would allow the user to be logged into a website (namely, Tumblr) several times. Much like you can do with a normal window and an incognito window.

According to Chrome's Developer Information on Cookies, I should be able to call cookieStore. But I can't seem to access or even find it. Is it possible to access cookieStore, and if so, how can I access it?


Solution

  • CookieStore is a datatype (think of it as a class) returned by other chrome.cookie methods.

    More specifically, only one method, chrome.cookies.getAllCookieStores:

    chrome.cookies.getAllCookieStores(function callback)  
    

    Lists all existing cookie stores.

    Parameters

    function callback
    The callback parameter should be a function that looks like this:

    function(array of CookieStore cookieStores) {...};
    

    Note that changing the object passed to your callback does not actually affect anything. It's purely informational, and you can't pass it to any API function (but you can use the id parameter in other calls)