Check the code bellow. In my chorome extension code i am getting error: Uncaught TypeError: Cannot read properties of undefined (reading 'get') when i try to read cookie. Whats wrong i am doing here?
content.js:
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!');
}
});
manifest.json:
{
"manifest_version": 3,
"name": "AutoMailSystem",
"version": "1.0.0",
"host_permissions": [
"*://*.test.com/"
],
"permissions": [
"cookies"
],
"content_scripts": [
{
"matches":["<all_urls>"],
"js":["jq.js","Content.js"]
}
]
}