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

204
Visualizações
Can`t add new item to context menu in Chrome (manifest 3)

I have face some difficulties during Manifest 3 to Manifest 3 migration: nothing works. I have developed a simple Chrome extension that adds a new item in the context menu, so you can search the inserted text in some website. It works correctly in the manifest 2, but not in the 3rd. So there is manifest code (3)

{
  "manifest_version": 3,
  "name": "name",
  "short_name": "shortN",
  "description": "This extension will work someday I hope so",
  "background": [{
    "service_worker": [ "background.js" ]
  }],
  "icons": {
    "128": "icons/128.png",
    "48": "icons/48.png",
    "32": "icons/32.png",
    "16": "icons/16.png"
  },
  "permissions": [ "contextMenus", "tabs", "activeTab" ],
  "version": "1.3"
}

And a sample of background code

chrome.runtime.onInstalled.addListener(function() {
    chrome.contextMenus.create({
        title: "title",
        contexts: ["selection"],
        id: "title1"
    });
});

chrome.contextMenus.onClicked.addListener(function (info, tab) {
    if (info.menuItemId === "title1") {
        let getToSite = "https://*" + info.selectionText
        chrome.tabs.create({index: tab.index + 1, url: getQ, selected: true});
    }
})

Can someone take a look and say whats wrong with it? Im also new to JS (like, three-days-new), so I do appreciate simple explanations Thank you!

about 4 years ago · Juan Pablo Isaza
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