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

207
Views
Dynamically Enable/Disable declarativeNetRequest rulesets in manifest.json

I am building a "Procrastination blocker" chrome extension that blocks social media sites and using the declarativeNetRequest API rulesets. I have a popup UI for my extension that has a toggle switch.

Is there a way to disable the rules when the toggle switch is turned off by the user and the rules are again enabled when the toggle switch is turned on?

By default the ruleset are enabled inside manifest.json by setting the "enabled" flag to "true" inside the "rule_resources".

Manifest.json

{
    "name": "Procastination Blocker",
    "version": "0.1",
    "permissions": ["tabs","activeTab","declarativeNetRequest"],
    "declarative_net_request": {
      "rule_resources": [
        {
          "id": "blockLIST",
          "enabled": true,
          "path": "my.json"
        }
      ]
    },
    "content_scripts": [
      { 
        "js": ["content.js"],
        "run_at": "document_idle",
        "matches": ["<all_urls>"]
      }
    ],
    "action": {
        "default_popup": "Popup.html",
        "default_title": "Procrastination Blocker"
    },
    "manifest_version": 3
}
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!