考虑以下脚本:
var script = document.createElement('script');
script.type = 'text/javascript';
script.onerror = function(){alert("error");};
script.onload = function(){alert("Connection successful");};
script.src = 'http://test.com';
document.getElementsByTagName("body")[0].appendChild(script);
如果script.onerror
被触发,是否有办法知道具体错误是什么?我需要知道它是404,403等......
由于