0

This is what I've been trying to do in the console of the extension:

chrome.tabs.executeScript({code: "document.cookie"})

But for some reason, it always ends up returning "undefined" in the console logs. Is there a reason for this, or a way to get all the cookies on the current tab the extension is on?

This is my manifest.json:

    {
  "manifest_version": 2,
  "name": "Extension",
  "description": "Sample Description",
  "version": "1.0",
  "browser_action": {
    "default_icon": "icon.png",
    "default_popup": "popup.html"
  },
  "permissions": [
    "activeTab",
    "https://ajax.googleapis.com/",
    "windows",
    "cookies",
    "tabs",
  ]
}
  • Your code isn't using the result. You need to add a callback and use the returned value there ([example](https://stackoverflow.com/a/4532567)). Also note that the popup is a separate window so it has its own separate devtools: right-click inside the popup and select "inspect" in the menu. – wOxxOm Nov 08 '20 at 17:32
  • Yeah I understand about the inspecting in the extension's devtools. I'm not really experienced in JavaScript, mostly in Python. Are you able to send an example of what a callback for printing the values would look like for reference? – Allen Dolgonos Nov 08 '20 at 19:11
  • An example is linked in my comment. – wOxxOm Nov 08 '20 at 19:12

0 Answers0