You can listen for the error (see this )
// make a script var s = document.createElement('script'); // set it up s.setAttribute('src',"file.js"); s.setAttribute('type',"text/javascript"); s.setAttribute('charset',"utf-8"); s.addEventListener('error', errorfunction, false); // add to DOM document.head.appendChild(s);
then in the errorfunction , find out what happened and try to fix it, as in catch
source share