Javascript solution (with jQuery, although you can do without it):
<script type='text/javascript'>
$(function(){
var files = [
'warning-large.png',
'warning-large-corrupted.png',
'http://www.example.com/none.gif',
'http://sstatic.net/stackoverflow/img/favicon.ico'
];
for ( var n in files ) {
var img = $('<img/>');
img.error(function(){
alert('error:\n' + this.src);
});
img.load(function(){
alert('success:\n' + this.src);
});
img.attr('src', files[n]);
}
});
</script>
source
share