3 ms·
You forgot the most important factor: Whether you're reusing that image on a different page. Embedding images in the HTML is basically saving an HTTP request a
by cperciva 10y ago
You forgot the most important factor: Whether you're reusing that image on a different page. Embedding images in the HTML is basically saving an HTTP request at the expense of not being able to cache the image separately from the HTML.
- 33degrees 10y agoYou can, however, embed images in CSS, which gives you both reduced requests and caching.
- rocky1138 10y agoThis seems like it should work, but have you ever tried it? Or, can you point me to some results of a test to show that it indeed caches the image embedded in the CSS?
- paulddraper 10y agoIf it's inline, then it's cached with whatever it's inlined into.
- echeese 10y agoThe problem is that now it's going to be sent with every request. So it'll make the first page faster for the initial request, but slower in the long run.
- 33degrees 10y agoI'm not sure how you figure that? The CSS file containing inline images would get cached, so nothing would be sent after the initial request.
- mikekchar 10y agoUnless you inline the CSS ;-)
- dorfsmay 10y agoExactly! On a typical site, a lot of images are reused across pages, if externalised then it's already cached in your browser.