declarative_net_request

Type Object
Mandatory No
Manifest version 2 or higher
Example
json

"declarative_net_request" : {
  "rule_resources" : [{
    "id": "ruleset",
    "enabled": true,
    "path": "rules.json"
  }]
}

Specify static rulesets for use with 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 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

json
"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

BCD tables only load in the browser