0

I'm trying to get the URL of the current tab from the extension which I'm building, but the vale is getting stored as undefined What do I need to solve this issue?

    tabBtn.addEventListener("click", function () {
        chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
        myLeads.push(tabs[0].url);
        localStorage.setItem("myLeads", JSON.stringify(myLeads));
        render(myLeads);
      });
    });
Emir
  • 5
  • 2
  • To see the `url` your `permissions` in manifest.json must have `tabs` or host permissions for this url. – wOxxOm Nov 14 '21 at 15:26
  • Post adding the permissions in the json the value is still undefined – Emir Nov 16 '21 at 07:22
  • 1) Don't forget to reload the extension after editing manifest.json. 2) Use devtools debugger: right-click inside the popup and select "inspect" in the menu. – wOxxOm Nov 16 '21 at 08:27
  • This worked for me now, Thanks – Emir Nov 17 '21 at 10:53

0 Answers0