chrome.cookies.get({url:"http://www.dahotre.com", name:"userid"}, function(){}) shows undefined in the console.
If I skip the optional empty function(), it throws an error.
chrome.cookies.get({url:"http://www.dahotre.com", name:"userid"}) shows Uncaught Error: Parameter 2 is required.
And if I use function(Cookie c){} as the second param, it throws SyntaxError: Unexpected identifier
Following is the permissions line from my manifest.json:
"permissions": [ "cookies", "http://www.dahotre.com/"],
When I inspect the cookies in my browser, I can most certainly find a cookie from the site www.dahotre.com with a name=userid and a integer content.
How to access this cookie in a chrome extension?
Try:
Your
function(Cookie c){}was a nice try, but JavaScript is dynamically typed language and those verbose types are used only for documentantion purpose.