bisq-network / bisq-website

@bisq-network website at https://bisq.network
35 stars 76 forks source link

Add Lazy Loading to images and iframes #340

Closed RiccardoMasutti closed 4 years ago

RiccardoMasutti commented 4 years ago

Replace #331

Why native lazy-loading?

According to HTTPArchive, images are the most requested asset type for most websites and usually take up more bandwidth than any other resource. At the 90th percentile, sites send about 4.7 MB of images on desktop and mobile. That's a lot of cat pictures.

Embedded iframes also use a lot of data and can harm page performance. Only loading non-critical, below-the-fold images and iframes when the user is likely to see them improves page load times, minimizes user bandwidth, and reduces memory usage.

SEO Benefits

Google has indicated site speed (and as a result, page speed) is one of the signals used by its algorithm to rank pages. And research has shown that Google might be specifically measuring time to first byte as when it considers page speed. In addition, a slow page speed means that search engines can crawl fewer pages using their allocated crawl budget, and this could negatively affect your indexation.

Page speed is also important to user experience. Pages with a longer load time tend to have higher bounce rates and lower average time on page. Longer load times have also been shown to negatively affect conversions.

Currently, there are two ways to defer the loading of off-screen images and iframes:

Either option can let developers include lazy-loading functionality, and many developers have built third-party libraries to provide abstractions that are even easier to use. With lazy-loading supported directly by the browser, however, there's no need for an external library. Native lazy loading also ensures that deferred loading of images and iframes still works even if JavaScript is disabled on the client.

Starting with Chrome 76, we are able to use the new loading attribute to lazy-load resources without the need to write custom lazy-loading code or use a separate JavaScript library.

Demo: ezgif-7-61e4604beabd

Source: https://web.dev/native-lazy-loading/