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

168
Vistas
Chrome Extension only works when popup is open

I'm trying to create a feature for an extension that has a checkbox, if the checkbox is checked the extension will stop collecting data, and if the checkbox is unchecked the extension will collect data. The feature works when the extension popup is open, and when I'm using the devtool. When the popup is closed and the checkbox is unchecked, it doesn't collect any data

I store the checkbox status in localstorage:

chrome.storage.local.set(
    {
      Privacy: document.getElementById("Privacy").checked,
    }

I call function to collect data if the checkbox is uncheck:

chrome.tabs.onActivated.addListener(function (activeInfo) {
  chrome.storage.local.get(["Privacy"], function (result) {
    if (result.Privacy != true || result.Privacy == null) {
      getTabInfo((activeTabId = activeInfo.tabId));
      console.log("inside privacy");
    } else {
      console.log("inside tabs.onActivated:");
      console.log("this is result.Privacy: ");
      console.log(result.Privacy);
    }
  });
})

I have tried : result.Privacy == false, that doesn't work either. I know its not collecting data because I don't see any data stored in the database. This is a sample of my manifest.json:

"background": 
{
    "scripts": ["js/background.js", "js/firebase.js"],
    "persistent": true
},


"permissions": [
        "tabs",
        "activeTab",
        "scripting",
        "*://*/*",
        "storage",
        "identity"
    ],
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