Search code examples
javascriptcssfirefox-addonfirefox-addon-sdk

Loading a CSS file when opening a tab with a local URL


I am opening a tab that loads a local HTML file from an addon (using addon-sdk) like this:

tabs.open({
  url: self.data.url('index.html'),
  onReady: myScript
});

But I don't see a way to load a CSS stylesheet that goes along with the HTML file. I would expect to not have to write inline styles.

Am I missing something? Surely there is a way to load the CSS using the API.


Solution

  • Add this in <head></head> section of index.html to include your css.

    <link rel="stylesheet" type="text/css" href="your_css_file.css">