Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

635
Visualizações
chrome extension: Uncaught TypeError: Cannot read properties of undefined (reading 'onClicked')

I have been creating a chrome extension that should run a certain script(index.js) on a particular tab on extension click.

service_worker.js

// action on extension click
chrome.browserAction.onClicked.addListener(function (tab) {
    chrome.tabs.executeScript({
        tabId: tab.id,
    }, { file: "index.js" });

});

I have also tried

chrome.action......

and

browser....

But nothing works, I am using manifest v3.

manifest.json

{
    "name": "Meet scraper",
    "version": "0.1",
    "author": "Naveenkumar M",
    "description": "Scrapes meet data from meetup.com",
    "manifest_version": 3,
    "permissions": [
        "activeTab",
        "tabs"
    ],
    "background": {
        "service_worker": "service_worker.js"
    }
}

And my index.js file is

console.log("Hello world")

I got the error enter image description here

correct me if I am wrong

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Manifest v2

The following keys must be declared in the manifest to use this API.

browser_action

check this link for more details

https://developer.chrome.com/docs/extensions/reference/browserAction/

Update 1 :

Manifest v3

you need to add actions inside your manifest file

{
  "action": { … }
}

and then you can call it like this

chrome.action.onClicked.addListener(tab => { … });
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda