可能重複:
My CSS is not getting injected through my content scriptChrome擴展CSS操縱
我一直試圖做一個Chrome擴展每次它在加載時谷歌的背景顏色更改爲黑色標籤。
我在我的manifest.json如下:
{
"name": "Background to black",
"manifest_version": 2,
"version": "1.0",
"description": "Google black",
"permissions": ["tabs", "http://www.google.com/*"],
"browser_action": {
"default_icon": "icon.png"
},
"content_scripts": [
{
"matches": ["http://www.google.com/*"],
"css": ["backgroundtoblack.css"],
"run_at": "document_start",
"all_frames": true
}
]
}
,這在我的backgroundtoblack.css:
body{
background: #000000;
}
但是它並沒有爲我工作,我不明白我做錯了什麼。
只是一個側面說明:已有擴展程序可以做到這一點,並且更多(如[this one](https://chrome.google.com/webstore/detail/fjnbnpbmkenffdnngjfgmeleoegfcffe))。 – Chris
嗯,我有興趣學習如何自己做。但是,無論如何感謝鏈接。 –
「谷歌的背景顏色」 - 你的意思是[google.com](http://google.com)頁面? – Pavlo