0

i am currently working on a chrome extension that to work it need to grab the active tab's url and check if it is "siteName" and when I log's the result to check why it was not working it does say undefined.

I have tried the following line of code and i have searched on google and did not find anything else

chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
  if (changeInfo.url) {
    console.log(changeInfo.url);
    if (changeInfo.url.includes(siteName)) {
      extensionActive = true;
    } else {
      extensionActive = false;
    }
  }
});

This is my manifest premisions

"manifest_version": 3,
"permissions": [
    "background",
    "webRequest",
    "activeTab",
    "pageCapture",
    "unlimitedStorage"
  ],
  • Please refer to this tutorial. [How to make Chrome Extension 04 How to use Service Worker](https://youtu.be/zdUptukxFzo) – Norio Yamamoto Mar 01 '23 at 07:27
  • To see the tab's `url` you need to add `"tabs"` to `"permissions"`. Also make sure you look at the [correct console](/a/10258029). – wOxxOm Mar 01 '23 at 09:18

0 Answers0