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

175
Visualizações
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 à 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