Categories
HTML

How to cache an image in HTML?

Spread the love

Sometimes, we want to cache an image in HTML.

In this article, we’ll look at how to cache an image in HTML.

How to cache an image in HTML?

To cache an image in HTML, we can add a link element.

For instance, we write

<link rel="preload" href="bg-image-wide.png" as="image" />

to add a link element that has the href attribute set to the URL of the image to cache.

And we set the rel attribute to preload to preload the image.

Conclusion

To cache an image in HTML, we can add a link element.

Leave a Reply

Your email address will not be published.

If you like the content of this blog, subscribe to my email list to get exclusive articles not available to anyone else.