declarativeNetRequest.Rule

描述匹配请求所采取的操作的对象。这些可以在由 manifest.json 的键 declarative_net_request 链接的静态规则资源中指定,或通过 declarativeNetRequest.updateDynamicRulesdeclarativeNetRequest.updateSessionRules 方法更动态地指定。

有关规则的更多信息,请参见 API 概述页面中的规则

类型

此类型的值为对象。它们包含以下属性:

action

declarativeNetRequest.RuleAction。如果此规则匹配,则要执行的操作。

condition

declarativeNetRequest.RuleCondition。触发此规则的条件。

id

number。在规则集中唯一标识规则的 ID。此项为必填项,应大于等于 1。

priority 可选

number。规则优先级。默认为 1。当指定时,应大于等于 1。有关优先级如何影响应用哪些规则的详细信息,请参阅匹配优先级

示例扩展

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Firefox for Android
Safari on iOS
Rule

Legend

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

Full support
Full support