【发布时间】:2021-12-22 10:24:43
【问题描述】:
我想要一个带有我自己的 CSS 代码的 Google Chrome 扩展程序,用于网站编程。我试图在 content_scripts 中包含我自己的 CSS 脚本,但它没有用。 我不能像 JavaScript 那样插入 css。 这是我的代码:
manifest.json
{
"name": "XXX",
"version": "0.0.1",
"manifest_version": 2,
"permissions": [
"tabs",
"http://*/*",
"https://*/*",
"file:///*/*"
],
"content_scripts": [
{
"matches": [
"*://www.google.com/*",
"*://google.com/*"
],
"css": [
"style.css"
],
"js": [
"index.js"
],
"all_frames": true
}
],
"web_accessible_resources": [
"style.css"
]
}
style.css
body{
background-color: #303030;
}
index.js
prompt('code injected');
【问题讨论】:
标签: css google-chrome-extension