declarativeNetRequest.Redirect

描述重定向应该如何执行的详细信息,作为 RuleActionredirect 属性。仅适用于重定向规则。

备注: 重定向操作不会重定向请求,请求会像往常一样继续进行,当:

类型

此类型的值为对象,包含以下属性:

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 GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Firefox for Android
Safari on iOS
Redirect

Legend

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

Full support
Full support