Skip to content

Instantly share code, notes, and snippets.

@fuzzywalrus
Last active November 22, 2017 22:48
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 fuzzywalrus/19030b8c87a3ee828c62eab15f92558d to your computer and use it in GitHub Desktop.
Save fuzzywalrus/19030b8c87a3ee828c62eab15f92558d to your computer and use it in GitHub Desktop.
Check if any given script has errored on load
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