docs.rodeo

MDN Web Docs mirror

declarative_net_request

{{AddonSidebar}} 

Type Object
Mandatory No
Manifest version 2 or higher
Example
"declarative_net_request" : {
  "rule_resources" : [{
    "id": "ruleset",
    "enabled": true,
    "path": "rules.json"
  }]
}

Specify static rulesets for use with {{WebExtAPIRef("declarativeNetRequest")}} . See static ruleset limits for information on the number of rulesets, enabled rulesets, and rules that can be specified.

See Permissions for more information on permission requirements.

[!NOTE] A rule containing unrecognized properties is loaded if it is otherwise valid, that is, unrecognized properties are ignored. Before Firefox 128, a rule with unrecognized properties was considered invalid and not loaded.

Syntax

The "declarative_net_request" key is an object that must contain the "rule_resources" property, an array that must include at least one object with these properties:

Name Type Description
"id" String A non-empty string uniquely identifying the ruleset. IDs beginning with '_' are reserved for internal use.
"enabled" Boolean Whether the ruleset is enabled by default. The `{{WebExtAPIRef("declarativeNetRequest.updateEnabledRulesets")}}`  method can be used to enable or disable a ruleset at runtime.
"path" String The path of the JSON ruleset relative to the extension directory. See the Rules section of the declarativeNetRequest API for information on the content of the ruleset JSON file.

Example

"declarative_net_request" : {
  "rule_resources" : [{
    "id": "ruleset_1",
    "enabled": true,
    "path": "rules_1.json"
  }, {
    "id": "ruleset_2",
    "enabled": false,
    "path": "rules_2.json"
  }]
}

Example extensions

Browser compatibility

{{Compat}} 

In this article

View on MDN