【问题标题】:How to make chrome extension work on all domain zones of specific site?如何使 chrome 扩展在特定站点的所有域区域上工作?
【发布时间】:2019-03-14 12:54:47
【问题描述】:

我有一个可以在谷歌翻译 com 上运行的小型 chrome 扩展程序 如何让它在所有域区域(不仅是 .com)上工作?

尝试了以下方法,但似乎不起作用。 "matches": [ "*://translate.google.*/*" ],

Error
Invalid value for 'content_scripts[0].matches[0]': Invalid host wildcard.

这不是Chrome extension: Run on all google domains and a specific page 的副本 我希望它只在翻译页面上工作。

  "matches": [ "*://*/*" ],
  "include_globs": [
    "*://translate.google.*/*"
  ]

这部分使它可以在 google.com 搜索页面上运行。 我不需要这个。

【问题讨论】:

  • @wOxxOm 我试过了。但我不希望它在 translate.google 您根本没有阅读该答案的页面上工作。
  • 所以您认为手动设置扩展中的所有列表项可以吗? crt.sh/?Identity=google.%25&iCAID=1348 看起来不是个好主意。
  • 正如我链接的答案中所解释的那样,将其转换为“匹配”条目列表非常简单(它也有谷歌使用的a list of the TLDs)。或者,您可以编写一个简单的转换器或 IDE 宏(也许某处已有一个)。 manifest.json 没有其他解决方案,除了链接答案中列出的解决方案。
  • 谢谢。应该可以关闭吧我应该删除它吗?

标签: google-chrome-extension


【解决方案1】:

感谢@wOxxOm

  1. 转到http://www.google.com/supported_domains
  2. 打开控制台并粘贴以下内容:
copy(document.body.innerText.split(" ").map((item) => { return `*://translate${item}/*` }))
  1. 转到您的清单文件并将 matches": [] 数组替换为您刚刚复制的内容。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多