Detect missing imageTag(s): Varia


From HTML tag :
<img src="picture1.gif" onerror="this.onerror=null;this.src='missing.gif';">

From script :

var imgsrc = 'picture1.gif';
var img = new Image();

img.onerror = function (evt) {
  alert(this.src + " can't be loaded.");
  }
img.onload = function (evt) {
  alert(this.src + " is loaded.");
  }

img.src = imgsrc;

blog comments powered by Disqus