Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
AddonSDK How to add a stylesheet
const { browserWindows } = require("sdk/windows");
for(let w of browserWindows){
AddStyleSheet("./myStyleSheet.css", viewFor(w) );
function AddStyleSheet(whatstylesheet,whatwindow){
var attr = 'id="my-css" type="text/css" href="' + whatstylesheet + '"';
var style = whatwindow.document.createProcessingInstruction('xml-stylesheet', attr);
whatwindow.document.insertBefore(style, whatwindow.document.documentElement);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment