I am trying to get a cookie specifically from a domain using this code:
Almost all Chrome API calls are asynchronous, so you need to use callbacks to run code in order:
function getCookies(domain, name, callback) {
chrome.cookies.get({"url": domain, "name": name}, function(cookie) {
if(callback) {
callback(cookie.value);
}
});
}
//usage:
getCookies("http://www.example.com", "id", function(id) {
alert(id);
});