diff --git a/index.js b/index.js index 1ee62b3..9a1fef3 100644 --- a/index.js +++ b/index.js @@ -91,6 +91,10 @@ function jsonp(url, opts, fn){ // create script script = document.createElement('script'); script.src = url; + script.addEventListener('error',function(e) { + cleanup(); + if (fn) fn(e); + },false) target.parentNode.insertBefore(script, target); return cancel;