0

I've been trying to make a simple chrome extension to intercept/cancel certain fetch request on linkedin using the chrome webRequest API..i think i did everything correctly but whenever the script tries to run i get this error:

Uncaught TypeError: Cannot read properties of undefined (reading 'onBeforeRequest')

script

chrome.webRequest.onBeforeRequest.addListener(
  function(details) {
    console.log("listening");
    return {cancel: details.url.indexOf("unwanted fetch url here") != -1};
  },
  { urls: ["<all_urls>"] },
  ["blocking"]
);

manifest

{
  "manifest_version": 2,
  "name": "someextension",
  "version": "1.0.0",
  "permissions": [
    "webRequest",
    "webRequestBlocking",
    "tabs",
    "<all_urls>",
    "webNavigation",
    "management",
    "http://*/*",
    "https://*/*"
  ],
  "content_scripts": [
    {
      "matches": [
        "*://www.linkedin.com/*"
      ],
      "js": [
        "script.js"
      ]
    }
  ]
}

i've been checking the webRequest API documentation and i've noticed that at "availability" it says "pending" as in it's not available currently..does this have anything to do with the error i'm having

M.KH
  • 365
  • 3
  • 15

0 Answers0