Note: This page is part of the blog post on SEO impact of image lazy-loading. It was setup to test if Google indexes the images setup to load lazily.

Test : Check if Google Bot indexes the images loaded via JavaScript on this page


To test it, head to Google Image search and search for site:tezify.com lazy loading. If you see only one the first image in the matching result, it means the image loaded lazily is not being indexed by the bot. If you do see both the images, it means the bot is indexing both the images on this page.



Image lazy loading check : Image loaded with img src

Code used to load this image:

<img class="img-center img-rounded img-responsive" 
			src="images/lazyloading1.png" 
			alt="Image lazy loading check : Image loaded with img src"  />
			
Image lazy loading check : Image loaded via JS

Code used to load this image:

<img class="img-center img-rounded img-responsive" 
			src="data:image/png;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" 
			mobile-data-src="images/lazyloading2.png" 
			data-src="images/lazyloading2.png" 
			alt="Image lazy loading check : Image loaded via JS"   />
			
<script>
function lazyloadimages() {
var imgDefer = document.getElementsByTagName('img');
for (var i=0; i<imgDefer.length; i++) {
  if(imgDefer[i].getAttribute('data-src') && imgDefer[i].className.indexOf('lazyload') == -1) {
    if (!window.isMobile)
      imgDefer[i].setAttribute('src',imgDefer[i].getAttribute('data-src'));
    else
    {
      if (imgDefer[i].hasAttribute('mobile-data-src'))
        imgDefer[i].setAttribute('src',imgDefer[i].getAttribute('mobile-data-src'));
      else
        imgDefer[i].setAttribute('src',imgDefer[i].getAttribute('data-src'));
    }
  } } }
window.onload = lazyloadimages;
</script>