Defer Offscreen images or videos are the ones that are positioned outside the screen (viewport) and hence not visible on the screen when a visitor loads a webpage. By indicating the browser not to load the resources currently outside the visible screen area, page load time can be improved.
Loading offscreen resources may affect user experience by downloading data that isn’t immediately required.
A massive performance boost can be gained as the media elements contain graphics and are commonly the heaviest resources on any page. Smart lazy-loading also called deferred loading is the solution to such problems on a website.
If you don’t defer offscreen pictures, all such assets of your webpage will load at once when one loads your webpage. It will increase page load time, which will eventually lower user experience and performance score. Let’s explain it with an example.
Let’s imagine your webpage has 15 images and 2 of them are on the front fold. Now if a user visits your website. All 15 images will load at once even if only 2 images are visible and others are below the fold. Your whole HTML structure will block and nothing will render until all the images and other things are completely loaded.
Defer Offscreen Images decreases page load time as it loads only the visible images and hence reduces the number of images that need to be loaded. So, your webpage’s HTML structure will not be blocked. Because of this process, the rendering time also decreases.
The visitor can only view the generated images if they need them. The user who bounces immediately or doesn’t scroll down will have fewer bytes delivered to their computer. It is literally possible to save money by lazy loading if your CDN provider charges by data transfer and HTTP requests. Those on limited data plans can also save money by lazy loading.
Lazy loading saves computing power and processing time to render a webpage hence saving battery life for hand-held devices such as smartphones or tabs.
As the load time decreases and also the site speed increases, the user experience will get better. This will take your website up to the SEO ranking.
The easiest ad best way to defer the loading of resources is to use RabbitLoader on your website. If you are using WordPress, consider trying our free plugin to lazy load images with several other features to score best in Google PageSpeed Insights. Our services can be used for other platforms, including your in-house developed websites with PHP/ASP/NodeJs, etc.
Nice to meet you. We are happy to discuss some of the modern methods we are using internally to best optimize the payload served from our client’s websites. We have discussed in the past how to reduce the image size without losing its quality, and in this post, we are going to focus on various loading techniques to separate out critical and non-critical elements and make the best use of the bandwidth and computation power available on the visitor’s device.
Our research starts from the key idea that only those media elements should be loaded with a high priority which is displayed inside of the viewport. And we know for sure, any such resource requested after TTI (Time to Interactive is the point after which a webpage is capable of reliably responding to user inputs.) is not flagged as a violation in the Lighthouse audit.
The <img> tag which is used to embed an image into the document now supports a new attribute called “loading” which tells the browser how the source specified for this element should be loaded. The “loading” attribute is optional and can have two possible values if present-
loading = "eager” – If this value is set, the browser loads the image immediately irrespective of the element’s visibility or the position with respect to the viewport
loading = "lazy"– The image loading is deferred till the browser thinks that the element is going to be visible soon. Typically it happens when a user scrolls the page and reaches a point precalculated by the browser when the load triggers.
<img loading="lazy" src="example.webp" alt="image-example" class="img-css-rules">
This feature is now supported by almost all modern browsers except IE, Safari, and Firefox for Android. All Chromium-based browsers may not support it below version 77.
The below example covers the basic concepts of using this API for an HTML page-
This feature is now supported by almost all modern browsers except IE. You can use a polyfill available for Intersection Observer.
For Rabbit Loader users, we have added this as an opt-in feature where iframes and pictures can be routed via our CDN and lazy-loaded in the best possible way across browsers without site owners putting any extra effort. Once enabled, defer offscreen images used in a webpage can be automatically deferred to boost page loading time and improve the speed index.