Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

166
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!