What is lazy loading? Advantages and Disadvantages of Lazy Loading

青灯夜游
Release: 2019-01-03 11:30:12
Original
7212 people have browsed it

Lazy loading, also known as on-demand loading, is an optimization technology for online content; it is of great use for both websites and web applications. Now let’s take you through lazy loading, hoping it will be helpful to you.

What is lazy loading? Advantages and Disadvantages of Lazy Loading

What is lazy loading?

Normally, when a user opens a web page, the entire page's content will be downloaded and rendered at once. While this allows the browser to cache the web page, there is no guarantee that the user will actually view all downloaded content.

For example, if an entire photo library is downloaded but the user leaves after viewing only the first image, the result is a waste of memory and bandwidth.

Unlike bulk loading which loads the entire web page at once and renders it to the user, lazy loading only helps load the required part when the user accesses the page i.e. when the user accesses the part of the page that requires it , this part of the content will be loaded and the remaining part of the content will be delayed.

What is lazy loading? Advantages and Disadvantages of Lazy Loading

How does lazy loading work?

When someone adds a resource (image, video, etc.) to a web page, the resource is referenced by a small placeholder. When a user browses a web page, the browser caches the actual resource and replaces the placeholder when the resource is displayed on the user's screen. For example, if a user loads a web page and immediately leaves, nothing other than the top of the page will load.

One form of lazy loading is infinite scroll, in which the content of a web page is loaded as the user scrolls down the page. It is a popular technology used by various websites.

Advantages and disadvantages of delayed loading

Advantages of delayed loading:

1. Reduce time Consumption and memory usage to optimize content delivery.

2. Users can connect to content faster because only part of the website needs to be downloaded when the user first opens the website.

3. Lower resource costs, save storage space, and enhance user experience

Because the content is only provided when the user needs it, rather than once. The required small part of the web page is loaded first so it takes less time and the loading of the rest of that part is delayed which saves storage. All of this enhances the user's experience as the requested content is served quickly.

4. From the perspective of business people, the optimal use of time and space resources makes it a cost-effective method. (Website owner’s perspective)

5. The content is provided to users without interruption, providing a truly uninterrupted browsing session, resulting in a higher customer retention rate, thereby reducing the chance of users leaving the website.

Disadvantages of lazy loading:

1. The extra lines of code to be added to the existing code to implement lazy loading can make the code a bit complicated.

2. Lazy loading may sometimes affect a website's ranking on search engines due to incorrect indexing of unloaded content.

Because resources default to placeholder content, search engine crawlers may misinterpret or ignore the content of the resource. Lazy loading of an entire component of a web page, such as a blog post, may cause search engines to bypass that component, resulting in fewer search engine results because the content is not indexed.

Summary:

Simplifying web content is an important part of shaping the user browsing experience. Adding lazy loading can make the website load faster and save bandwidth. , and provide a truly uninterrupted browsing session. Dynamically loading resources allows users to browse more content, and users can continuously load new content by scrolling the page.

Lazy loading, despite its drawbacks, has great advantages because the optimal utilization of two main resources (time and space) and many more advantages make us overlook its disadvantages.

The above is the entire content of this article, I hope it will be helpful to everyone's study. For more exciting content, you can pay attention to the relevant tutorial columns of the PHP Chinese website! ! !

The above is the detailed content of What is lazy loading? Advantages and Disadvantages of Lazy Loading. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!