Lazy-loading (or on-demand loading) is an online content optimization technique for websites or web apps.
In bulk loading, users receive an entire page in one shot. However, the lazy-loading concept supports loading only necessary resources and deferring non-critical ones until the user needs them. The same applies to images where non-critical usually means off-screen.
A trendy example of the lazy-loading technique is the infinity scroll, where the web page content loads as (and when) users scroll down the page.
Pros & Cons of Lazy-Loading
Lazy-loading is a relatively uncontroversial performance improvement technique. It is well used to cut down needless downloads for sites with much inline imagery, benefiting users and project stakeholders alike. However, there are pros and cons as with any technique.
- On-demand loading reduces time consumption and memory usage, thus optimizing content delivery. In addition, since only a fraction of a web page required is loaded first, the time taken is less, and loading the rest of the section is delayed saving storage. All of this enhances the user’s experience as the requested content is fed quickly.
- No unnecessary code execution.
- Optimal time and resources make it cost-effective for website owners.
- It may be complicated to add the extra lines of code to existing ones to implement lazy-load.
- Lazy-loading may affect the website’s search engine rankings due to incorrect indexing of the unloaded content.