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

159
Vistas
How to retrieve the active tab ID on my content script?

In my manifest file I have both tabs and activeTab permssion. I'm trying to obtain the current tab id from my content script, here is what I'm doing:

  console.log("here");
  browser.tabs.getCurrent()
    .then(getTab)
    .catch(reportTabError);
    function reportTabError(error) {
      console.error(`Could not process: ${error}`);
    }       
    function getTab(tabInfo){
      console.log("here 2"); //this never fires
      window.currentTabId = tabInfo.id;
    }

I also did a different version, same result:

  console.log("here");
  browser.tabs.query({currentWindow: true, active: true})
    .then(getTab)
    .catch(reportTabError);
    function reportTabError(error) {
      console.error(`Could not process: ${error}`);
    }       
    function getTab(tabInfo){
      console.log(tabInfo.id); //this never fires
      //window.currentTabId = tabInfo.id;
    }

The overall idea is to store the active tab IDs for a possible future update. What I want to achieve is to eventually notify all open tabs that the user changed the settings in the option page, and to update the interface loaded in the tabs accordingly.

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