chrome 扩展匹配 url 检查子路径

问题描述 投票:0回答:1

如果网址是

index.js
,我想运行我的
https://www.themoviedb.org/movie/<any-movie-id>
,但如果它有像
https://www.themoviedb.org/movie/<any-movie-id>/<sub-path>

这样的子路径,则不希望它运行
"content_scripts": [
    {
        "matches": ["https://*.themoviedb.org/movie/*", "https://*.themoviedb.org/tv/*"],
        "js": ["src/index.js"],
        "css": ["src/index.css"]
    }
]
regex google-chrome-extension match
1个回答
0
投票

您可以使用

exclude_globs
并执行类似的操作

"matches": [
  "https://www.themoviedb.org/movie/*"
],
"exclude_globs": ["https://www.themoviedb.org/movie/*/*"]
© www.soinside.com 2019 - 2024. All rights reserved.