DEV Community

Ahmad
Ahmad

Posted on

URL problem in JS

saveT.addEventListener('click', function () {
  chrome.tabs.query({ currentWindow: true, active: true }, function (tabs) {
      myLeads.push(tabs[0].url);
        read(myLeads);
  })
});

Enter fullscreen mode Exit fullscreen mode

I am trying to get the URL of the currant page for me chrome extension but it dose not working and give me this message in the console

Cannot read properties of undefined (reading 'query')
    at HTMLButtonElement.<anonymous> 
Enter fullscreen mode Exit fullscreen mode

and this my JSON file

{
    "manifest_version": 3,
    "version": "1.0",
    "name": "Leads Tracker",
    "action": {
        "default_popup": "Examples.html",
        "default_icon": "icons8-rfid-signal-80.png"
    },
    "permissions": [
        "tabs"
    ]
}

Enter fullscreen mode Exit fullscreen mode

Top comments (0)