Skip to content

Instantly share code, notes, and snippets.

@wintorez
Created October 6, 2017 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wintorez/fe1f0b8ad70a30e1b4506a3655718223 to your computer and use it in GitHub Desktop.
Save wintorez/fe1f0b8ad70a30e1b4506a3655718223 to your computer and use it in GitHub Desktop.
Use these functions to inject JavaScript and StyleSheets using Console
var injectStyle = function(pathToStyle) {
var head = document.getElementsByTagName("head")[0];
var link = document.createElement("link");
link.type = "text/css";
link.rel = "stylesheet";
link.href = pathToStyle;
head.appendChild(link);
};
var injectScript = function(pathToScript) {
var head = document.getElementsByTagName("head")[0];
var js = document.createElement("script");
js.type = "text/javascript";
js.src = pathToScript;
head.appendChild(js);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment