Currently the best (the simplest) way to get site cookies in extension is like this:
chrome.cookies.get({ url: 'http://example.com', name: 'somename' },
function (cookie) {
if (cookie) {
console.log(cookie.value);
}
else {
console.log('Can't get cookie! Check the name!');
}
});
So now you don't need content script for this but don't forget to include permissions into manifest:
"permissions": [
"cookies",
"*://*.example.com/*"
]
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…