0

If I use the same image file(for example- image01.jpg) within a single page multiple times, will the browser load each image separately? or the image will only once be loaded and then will be reused for the rest of the embedded code? Below is an example.

<body>
    <img src = 'images/image01.jpg"/>
    <img src = 'images/image01.jpg"/>
    <img src = 'images/image01.jpg"/>
</body>

In the above example, will the browser download image01.jpg once? or thrice?

1 Answers1

2

Default behavior for most browsers is to cache images on first load. Multiple calls for same image would be served from the cache.

If you wish to disallow browser caching read more here: How to control web page caching, across all browsers?

riesa
  • 86
  • 1
  • 5
  • I am surprised more people have not upvotes this answer. I have been asked this question once or twice a month for years now. – William Patton May 05 '20 at 09:00