I have a User Script and I want to apply an external CSS to any web page u开发者_如何转开发sing that User Script. What possibly could be done for this?
OR
Is it possible that by using JavaScript I can apply an external CSS to any web page?
I am using the following code but it is not working :
var fileref=document.createElement("link");
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", "class.css");
document.getElementsByTagName("head")[0].appendChild(fileref);
<link rel="stylesheet" type="text/css" href="class.css" />
精彩评论