With the same delayed loading of images, we have in the source code an image without (with empty) src , for example:

 <img src='' data-src='http://example.com/img.jpg'> 

Let's say JS script at the right time, we will substitute the URL from another attribute into src and the browser will load it.

We need this behavior. However, search engines such images are not indexed.

How to achieve that the image has been indexed by the search engine, but not loaded by the user's browser?

  • one
    And you did not consider the option to generate src on the server through a script, depending on the user-agent? - AkaInq

1 answer 1

Since search bots cannot be in javascript, you can give them pictures in the <noscript> (obviously, users who have turned off javascript will also see these pictures)

 <noscript> <img src='http://example.com/img.jpg' alt='крутая картинка' title='крутая картинка'> </noscript> <img src='' data-src='http://example.com/img.jpg'> 

Alt and title will help search engines to understand what the pictures.

You can, in principle, determine the search bots for the user-agent, but the issuance of different content to search bots and people can go sideways (in theory).