I have an *.css file that I want to insert into pages and tried two ways:
-
append
link
element todocument.head
let cssLink = document.createElement(“link”);
cssLink.setAttribute(“rel”, “stylesheet”);
cssLink.setAttribute(“type”, “text/css”);
cssLink.setAttribute(“href”, “style.css”);
document.head.appendChild(cssLink); -
use
tabs
APIbrowser.tabs.insertCSS({file: “style.css”});
activeTab
permission is in my manifest, there’s no problem.
In both ways I got same result. Stylesheets hasn’t been inserted into external websites but it worked for in-extension page.