当我在应重定向到
urlFilter
页面的规则中将网站的确切 URL 指定为 /questions
时,它会不断错误地重定向该网站的每个页面(例如个人资料、特定问题等)。
[
{
"id": 1,
"priority": 1,
"action": {
"type": "redirect",
"redirect": {
"url": "https://stackoverflow.com/questions"
}
},
"condition": {
"urlFilter": "https://stackoverflow.com",
"resourceTypes": ["main_frame"]
}
}
]
测试
https://stackoverflow.com | redirected (OK) |
https://stackoverflow.com/another | redirected (FAIL) | expected: not redirect
如何在ManifestV3中制定仅重定向
https://stackoverflow.com
?
你应该能够使用
[
{
"id": 1,
"priority": 1,
"action": {
"type": "redirect",
"redirect": {
"url": "https://stackoverflow.com/questions"
}
},
"condition": {
"urlFilter": "https://stackoverflow.com/|",
"resourceTypes": ["main_frame"]
}
}
]
因为
|
指示其后不能有更多字符。
chrome.declarativeNetRequest
- URL 过滤器语法 - Chrome 扩展 API