gpt4 book ai didi

google-chrome - Chrome 扩展程序 - 内容脚本匹配是否仅限于权限?

转载 作者:行者123 更新时间:2023-12-04 01:50:04 25 4
gpt4 key购买 nike

我正在制作一个 chrome 扩展程序,并且正在查看我的 manifest.json 文件并意识到了一些事情:

我有权访问这样的网站:

"permissions": [
"*://*.google.com/*",
"*://*.twitter.com/*",
]

如果我使用 <all_urls>对于我的内容脚本,它是否仅限于 Google 和Twitter 域?或者它会在没有权限的情况下将脚本注入(inject)其他网站吗?

最佳答案

如前所述here ,

If your content script's code should always be injected, register it in the extension manifest using the content_scripts field. If you want to inject the code only sometimes, use the permissions field instead.

我相信 all_urls 会覆盖权限。在我的一个使用 all_urls 的扩展上对此进行测试后,它实际上在非 google/twitter 域上工作。然后,我在 chrome://extensions 中单击了我的扩展程序的权限链接,它告诉我该扩展程序可以“读取和更改您访问的网站上的所有数据”

关于google-chrome - Chrome 扩展程序 - 内容脚本匹配是否仅限于权限?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40832641/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com