declarativeNetRequest.Rule

The object describing the actions to take for matching requests. These can be specified in the static rule resources linked by the manifest.json's declarative_net_request key, or more dynamically through the declarativeNetRequest.updateDynamicRules or declarativeNetRequest.updateSessionRules methods.

See Rules on the API overview page for more information about rules.

Type

Values of this type are objects. They contain these properties:

action

declarativeNetRequest.RuleAction. The action to take if this rule is matched.

condition

declarativeNetRequest.RuleCondition. The condition under which this rule is triggered.

id

number. An ID that uniquely identifies a rule within a ruleset. Mandatory and should be >= 1.

priority Optional

number. Rule priority. Defaults to 1. When specified, should be >= 1. See Matching precedence for details on how priority affects which rules are applied.

Example extensions

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Firefox for Android
Safari on iOS
Rule
Chrome – Full support
Chrome 84 (Release date: 2020-07-27)
footnote Full support
Edge – Full support
Edge 84 (Release date: 2020-07-16)
footnote Full support
Firefox – Full support
Firefox 113 (Release date: 2023-05-09)
footnote Full support
Opera – Full support
Opera 70 (Release date: 2020-07-27)
footnote Full support
Safari – Full support
Safari 15 (Release date: 2021-09-20)
footnote Full support
Firefox for Android – Full support
Firefox for Android 113 (Release date: 2023-05-09)
footnote Full support
Safari on iOS – Full support
Safari on iOS 15 (Release date: 2021-09-20)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support