I'd like to add a custom style sheet in a page without a content script. My CSS is OK, but the code below, using the onUpdated
and onCreated
event listeners do not work.
Part of manifest.json
:
"permissions": [
"http://www.site_domain.com/*",
"tabs"],
background.html:
chrome.tabs.onUpdated.addListener(function (tab) {
var tabUrl = tab.url;
if (tabUrl.indexOf("site_domain") != -1) {
changeBgkColor();
}
});
chrome.tabs.onCreated.addListener(function (tab) {
var tabUrl = tab.url;
if (tabUrl.indexOf("site_domain") != -1) {
changeBgkColor();
}
});
function changeBgkColor(){
chrome.tabs.insertCSS(null, {file:"css/styles.css"})
};