Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Will browser load the same image file if it's called multiple times in the same page?

Tags:

html

browser

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?

like image 464
Fahad Ahmed Avatar asked Nov 01 '25 15:11

Fahad Ahmed


1 Answers

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?

like image 50
riesa Avatar answered Nov 03 '25 05:11

riesa



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!