开发者

How to apply CSS using User Scripts

开发者 https://www.devze.com 2023-04-13 01:20 出处:网络
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?

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" />
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号