Last active
November 22, 2017 22:48
-
-
Save fuzzywalrus/19030b8c87a3ee828c62eab15f92558d to your computer and use it in GitHub Desktop.
Check if any given script has errored on load
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 myScript = document.createElement('script'); | |
myScript.src = 'http://www.madeupurl.com/script.js'; | |
myScript.onload = function() { | |
console.log('Script loaded.'); | |
}; | |
myScript.onerror = function() { | |
console.log('script failed.'); | |
}; | |
document.head.appendChild(myScript); | |
//https://gist.github.com/AllThingsSmitty/889acd01889c84ff162c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment