Created
October 6, 2017 14:59
-
-
Save wintorez/fe1f0b8ad70a30e1b4506a3655718223 to your computer and use it in GitHub Desktop.
Use these functions to inject JavaScript and StyleSheets using Console
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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