Answers for "injected stylesheet remove"

1

injected stylesheet remove

/* Answer to: "injected stylesheet remove" */

function loadCSS(file) {
  var link = document.createElement("link");
  link.href = chrome.extension.getURL(file + '.css');
  link.id = file;
  link.type = "text/css";
  link.rel = "stylesheet";
  document.getElementsByTagName("head")[0].appendChild(link);
}

function unloadCSS(file) {
  var cssNode = document.getElementById(file);
  cssNode && cssNode.parentNode.removeChild(cssNode);
}
Posted by: Guest on March-12-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language