gpt4 book ai didi

javascript - 网址更改时扩展程序未加载

转载 作者:行者123 更新时间:2023-11-27 23:38:40 25 4
gpt4 key购买 nike

当我点击链接时,我的 content.js 没有运行。 url 发生变化(按 F5 时运行 content.js)。更新的内容位于框架内。

如何在不按 F5 的情况下触发 content.js 运行?

{
"name":"My name",
"description":"My description!",
"version":"1",
"manifest_version":2,
"browser_action": {
"default_icon": "icon.png"
},
"content_scripts": [
{
"matches": ["http://www.somePage.com/article*"],
"js": ["content.js"]
}]}

最佳答案

您能否尝试将“all_frames”设置为 true,以便当页面中的框架更新时,内容脚本将再次注入(inject),如下所示:

"content_scripts": [
{
"matches": [ "http://www.somePage.com/article*" ],
"all_frames": true,
"js": [ "content.js" ]
}

关于javascript - 网址更改时扩展程序未加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33903417/

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