how to get url associated with a cookie in chrome extension?

google-chrome-extension

Solution

You can build the URL from the information you've got from `getAll()`:

var cookie; // one single cookie from the array

var url = '';
// get prefix, like https://www.
url += cookie.secure ? 'https://' : 'http://';
url += cookie.domain.charAt(0) == '.' ? 'www' : '';

// append domain and path
url += cookie.domain;
url += cookie.path;

console.log(url); // something like "https://www.stackoverflow.com/"

Problem

So I am using `chrome.cookies.getAll({}, function(c){console.log(c);})` to get all the cookies stored on the system. However, if I need to process the resulting cookie to either delete or whatever, I need a URL associated with each cookie. The URL strangely is not in the cookie structure: http://developer.chrome.com/extensions/cookies.html#type-Cookie Anyone know how to get the URL associated with a cookie?

Original source