【发布时间】:2022-11-11 05:37:54
【问题描述】:
我一直在制作 chrome 扩展来更改 youtube 订阅按钮的颜色,但它似乎不起作用 这是我的代码 清单.json: `
{
"manifest_version": 3,
"name": "Red Subsccribe Button",
"description": "Brings back the red subscribe button",
"version": "1.0",
"content_scripts": [{
"css": ["styles.css"],
"matches": ["https://*.youtube.com/watch/*"]
}]
}
样式.css: `
.yt-spec-button-shape-next--mono.yt-spec-button-shape-next--filled {
color: #080808;
background-color: #c00;
}
我看过很多其他帖子,但没有运气。加载页面后没有任何结果。
【问题讨论】:
-
问题肯定是由于您的内容脚本试图在 youtube.com/watch/* 上注入...当我去 YouTube 时,这不是他们拥有的 URL 模式。实际模式是 youtube.com/watch?v=VIDEOID ...因此您的内容脚本永远不会注入。解决方案是将模式更改为 youtube.com/*
标签: css google-chrome-extension