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

209
Vistas
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
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