Is there any way to access cookies from Chrome extension? this code
document.cookie.length
always returns - 0.
See Question&Answers more detail:osIs there any way to access cookies from Chrome extension? this code
document.cookie.length
always returns - 0.
See Question&Answers more detail:osCurrently 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/*"
]