Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

137
Vistas
Chrome extension action.onClicked

I am building a chrome extension and I use this code to open the popup in new window. (Using manifest v3) It suddenly stopped working today.

Uncaught TypeError: Cannot read properties of undefined (reading 'onClicked') Yesterday it worked just fine and it corresponds with chrome extension documentation. Anyone knows what the issue could be?

Here is my code:

chrome.action.onClicked.addListener(tab => {
    chrome.windows.create({
        url: chrome.runtime.getURL("popup.html"),
        type: "popup",
        height: 800,
        width: 516
      }, function(win) {
      });
});
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Thanks @woxxom. I have deleted action from the manifest. Didn't realize it's needed for the chrome.action to work. Fixed.

about 4 years ago · Juan Pablo Isaza Denunciar

0

This question was already answered, but I wanted to post a full example since I couldn't find a post that had both extension code and corresponding manifest.json.

Here is full, valid example using Manifest V3.

// File: manifest.json //

{
    "manifest_version": 3,
    "name": "My extension",
    "description": "Extension that extends things",
    "author": "Me",
    "version": "0.1",
    "content_scripts": [
      {
        "matches": [
          "https://*"
        ],
        "js": ["content.js"]
      }
    ],
    "icons": { "48":  "icons/icon128.jpg",
              "128":  "icons/icon512.jpg"},
    "background": {
      "service_worker": "background.js"
    },
    "action": {},
    "permissions": [
      "storage",
      "downloads",
      "tabs"
  ]
}
// File: background.js //

// Called when the user clicks on the browser action.
chrome.action.onClicked.addListener(tab => {
    // Send a message to the active tab
    chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
      var activeTab = tabs[0];
      chrome.tabs.sendMessage(activeTab.id, {"message": "clicked_browser_action"});
    });
  });

(Obviously remove the comment from the .json file before copying it, and adjust the permissions of your extension appropriately.)

Note that if you're using a version of Chrome below Chrome 93, your manifest.json and background.js must be in the SAME directory.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda