Skip to content

Instantly share code, notes, and snippets.

@BGMcoder
Last active December 17, 2015 20:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BGMcoder/636143a8e9c40cca2511 to your computer and use it in GitHub Desktop.
Save BGMcoder/636143a8e9c40cca2511 to your computer and use it in GitHub Desktop.
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