【发布时间】:2023-03-29 02:00:01
【问题描述】:
我有一个像这样的manifest.json 文件:
{
"name": "YouTube Trending to Paid promotion!",
"manifest_version": 2,
"version": "1.0",
"description": "Change Trending to Paid promotion!",
"permissions": ["tabs", "*://*.youtube.*/*"],
"browser_action": {
"default_icon": "icon.png"
},
"content_scripts": [
{
"matches": ["*://*.youtube.*/*"],
"js": ["popup.js"]
}
]
}
对于我的 JS 扩展,它只找到第 41 个 <span> 并重命名内容。当我直接注入它时,它工作正常。但是当我尝试上传它时,Chrome 给了我这个错误信息:Invalid value for 'content_scripts[0].matches[0]': Invalid host wildcard.
我的 JS 如下:
document.getElementsByTagName("span")[39].textContent="Paid promotion!";
有人知道是什么导致了错误吗?
【问题讨论】:
标签: javascript json google-chrome google-chrome-extension