How to get Firefox Greasemonkey script to use a local cascading stylesheet?

Posted by Umber Ferrule on Super User See other posts from Super User or by Umber Ferrule
Published on 2010-01-12T10:41:42Z Indexed on 2010/04/12 12:03 UTC
Read the original article Hit count: 359

Filed under:
|
|
|

What's the correct syntax to link to a CSS file in the same directory as a Greasemonkey JavaScript? I've tried the following but it doesn't work:

var cssNode = document.createElement('link');
cssNode.type = 'text/css';
cssNode.rel = 'stylesheet';
cssNode.href = 'example.css';
cssNode.media = 'screen';
cssNode.title = 'dynamicLoadedSheet';
document.getElementsByTagName("head")[0].appendChild(cssNode);

If I can get this to work, it would be a lot easier than encasing CSS changes in JavaScript.

© Super User or respective owner

Related posts about firefox

Related posts about greasemonkey