Check if image exists using javascript

by satheeshkumar 2014-10-31 15:13:53

Check if image exists in given url using javascript,
 
<script type='text/javascript'>
var image = new Image(); 
image.src = "image.jpg"; //your image path here
if (image.width == 0)
 {
  alert("no image");
 }
else
{
 alert("Image Exists");
}
</script>
1687
like
0
dislike
0
mail
flag

You must LOGIN to add comments