3
我試圖做一個擴展,改變頁面樣式表。我改變一些風格類似的背景顏色,但我不能改變整個樣式表改變Chrome擴展中的頁面樣式表
的manifest.json文件
{
"name": "change stylesheet",
"version": "1.0",
"permissions": [
"tabs", "http://*/*", "https://*/*"
],
"browser_action": {
"default_title": "Set this page's style",
"default_icon": "icon.png",
"popup": "popup.html"
}
}
部分在哪裏popup.htm Java腳本調用
function click() {
chrome.tabs.executeScript(null,
{code:"document.getElementById('stylesheet').href = 'style1.css'"});
window.close();
}
你有錯誤?是否有'id =「樣式表」元素? – pimvdb