declarativeNetRequest.Redirect
描述重定向应该如何执行的详细信息,作为 RuleAction
的 redirect
属性。仅适用于重定向规则。
备注: 重定向操作不会重定向请求,请求会像往常一样继续进行,当:
- 操作不更改请求。
- 重定向 URL 无效(例如,
redirect.regexSubstitution
的值不是有效的 URL)。
类型
此类型的值为对象,包含以下属性:
extensionPath
可选-
string
。相对于扩展目录的路径。应以“/”开头。仅当资源在web_accessible_resources
中列出时,请求的发起者才能跟随重定向。 regexSubstitution
可选-
string
。规则指定了regexFilter
的替换模式。regexFilter
在 URL 中的第一个匹配项将用此模式替换。在regexSubstitution
中,使用反斜杠转义的数字(\1
到\9
)来插入相应的捕获组。\0
指整个匹配的文本。 transform
可选-
declarativeNetRequest.URLTransform
。要执行的 URL 转换。 url
可选-
string
。重定向的 URL。不允许重定向到 JavaScript URL。
示例扩展
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | ||||||
---|---|---|---|---|---|---|---|
Redirect |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.