gpt4 book ai didi

javascript - Chrome 错误页面上的内容脚本

转载 作者:行者123 更新时间:2023-11-30 05:33:18 24 4
gpt4 key购买 nike

如何在 Google Chrome 错误页面上运行我的扩展程序内容脚本?

例如“此网页不可用”错误页面?这是我的 manifest.json 配置:

{
"manifest_version": 2,
"name": "injectbox",
"version": "1.1",
"background": {
"scripts": ["jquery-1.11.1.min.js", "bg.js" ]
},
"content_scripts": [
{
"js": [ "jquery-1.11.1.min.js" ],
"matches": [ "<all_urls>" ],
"match_about_blank": true,
"run_at": "document_end"
},
{
"js": [ "content.js" ],
"css":["styles.css"],
"matches": [ "<all_urls>" ],
"match_about_blank": true,
"run_at": "document_end"
}
],
"permissions": [
"tabs", "http://*/*", "https://*/*", "file://*/*", "ftp://*/*",
"webRequest",
"storage"
]
}

最佳答案

我不认为这是可能的,很可能这是一个内部 chrome:// 页面,它被排除在页面匹配之外。

另一种解决方案是监听 webRequest/webNavigation API 中的错误事件,并用您自己的错误页面替换错误页面。

关于javascript - Chrome 错误页面上的内容脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25502927/

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