After setting the image to lazy loading, the first screen will be faster, but will the content caught be less?
Will the content captured be less after setting images to lazy loading on the first screen? According to the definition of the specification document, lazy loading changes when resources are retrieved, not what is written in the page document. What really needs to be judged separately is two things: where the improvement in first screen time comes from, and whether the content that has not been retrieved depends on scrolling to appear.
A slow first screen is usually caused by rendering blocking, not too many images
The definition given in the specification document is: lazy loading is a strategy of marking resources as non-critical (non-blocking, non-critical), loaded only when needed, which serves to shorten the critical rendering path and thus reduce the page loading time. The same document explicitly states that by default, style sheets are treated as rendering blocking resources, and the browser will not render processed content before the style object model is completed.
This means: The reason for the slow first screen is often in styles and scripts, changing all images to lazy loading will not solve it. First confirm which type of resource is blocking rendering, and then decide what to set for lazy loading. The division of labor between the program layer and the resource layer is also different: The content management system layer can improve the page loading speed and concurrent carrying, AnQiCMS gives the official line that compared to traditional PHP systems, the loading speed has been significantly improved, but it can't control whether the style sheet on a certain page is blocking rendering.
The scope of the effect of lazy loading
The applicable objects listed include images, embedded frames, videos, and audio, in a way that adds the loading attribute to the element, indicating that the browser should delay loading off-screen resources until the user scrolls near them. That is, the delayed loading deals with the 'retrieve time'. It does not remove tags, does not change the alternative text and address, and the page structure itself remains unchanged.
Something else to pay attention to is another approach: using scripts to write the address into the element only when scrolling. This approach changes the content of the document itself and is not the same as delayed loading. When discussing whether the content will be read, the two should be separated.
Table of processing by resource type categorization
| Resource type | Default processing | Whether to set lazy loading | Reason |
|---|---|---|---|
| Main image on the first screen | Taken with the first screen | Not set | Belongs to critical requests |
| List thumbnail (within the first screen) | Taken with the first screen | Not set | Delay with no benefit |
| Long article interior illustration | By position | Set | Mostly off screen |
| Video and audio embedding | By position | Set | Large size and not essential for the first screen |
| Stylesheet | Rendering block | Not applicable | Handle the key style separately |
The only criterion for grading is whether the resource appears in the visible range of the first screen. Whether to delay it depends on the length of the page, which is easy to delay the main picture on the first screen.
Connection with automatic image matching and sitemap
Content sites often entrust the first screen image to the automatic image matching capability according to the title content. After setting the lazy loading, the images that should be delayed are only the images in the list and the lower part of the text, and the image matched to the first screen position should be kept loading with the first screen.
The media address will also appear in the site map. The image addresses listed in the Sitemap should be consistent with the actual addresses used on the page: If the address source is rewritten by methods other than lazy loading, the list will point to a form that cannot be obtained from the page. For sites whose address form has been adjusted by pseudo-static rules, this step needs to be checked again.
The trade-off between anti-crawling and image readability
There is a measure in the anti-crawling measures to add interference codes to the content. It has no effect on the delayed loading: the interference code changes the quality of the content when it is taken in bulk, and the delayed loading changes the time when it is retrieved. But when both are叠加 together, attention should be paid, as the pictures in the text that depend on script injection may be delayed by the delayed loading or deformed under the interference logic, and confirming each type of visitor is more stable than a one-size-fits-all approach.
Check which two places after the modification
Is the first screen time really improved, if almost unchanged, it means the bottleneck is in the style and script, and we should go back to the rendering blocking item and rearrange it; secondly, can the images in the long page still be retrieved under normal scrolling, and can the media addresses in the site map be accessed to the corresponding resources.
Common questions
Question: Will lazy loading affect the text that is read on the page?Answer: No. The text content is in the document, and lazy loading is for the retrieval timing of images, embedded frames, and media resources.
Question: Wouldn't it be safer to not delay loading all images?Answer: The cost of a long page is that the number of requests for the first screen increases. A more stable approach is to keep the first screen and the visible part of the list loaded directly, and the rest loaded with delay based on position.
Question: Should video embedding be set with lazy loading?Answer: It is recommended to set it. Videos and audio files are large and usually not on the first screen, and they belong to the objects explicitly listed in the document.