Real'sHowTo AddThis Feed Button
Custom Search

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

If you find this article useful, consider making a small donation
to show your support for this Web site and its content.

Written and compiled by Réal Gagnon ©1998-2015
[ home ]