injected stylesheet remove

Solutions on MaxInterview for injected stylesheet remove by the best coders in the world

showing results for - "injected stylesheet remove"
Mika
19 Apr 2017
1/* Answer to: "injected stylesheet remove" */
2
3function loadCSS(file) {
4  var link = document.createElement("link");
5  link.href = chrome.extension.getURL(file + '.css');
6  link.id = file;
7  link.type = "text/css";
8  link.rel = "stylesheet";
9  document.getElementsByTagName("head")[0].appendChild(link);
10}
11
12function unloadCSS(file) {
13  var cssNode = document.getElementById(file);
14  cssNode && cssNode.parentNode.removeChild(cssNode);
15}
16