Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can browsers cache the embedded base64 images also?

Tags:

html

browser

I was wondering if any of the modern browsers actually cache the embedded images -- base64 strings, or not?

Also is that a possibility in the near future? based on the official documents by either W3C or major browsers.

like image 916
Mahdi Avatar asked Dec 12 '13 11:12

Mahdi


2 Answers

I don't think so, because you're missing an Resource Identifier as the key for the cached image. With embedded images you only have the data itself.

Furthermore a potential conditional request for inlined images must be at the level of the HTML document containing it. The inlined image is just data with no additional request. But HTTP does not support something like conditional requests for parts of the data.

like image 191
Fabian Barney Avatar answered Sep 23 '22 06:09

Fabian Barney


As I understand it, if the base64 string is part of the HTML document (inline) then it will both have to be downloaded and parsed as an image each time the document is downloaded - there is no way to cache fragments of documents. If it is a background image in an external CSS file then it can be cached with the CSS file, but will still need to be parsed with every request. I have also read that base64 encoding adds circa 30% overhead on top of the image bytes, but this can largely be negated by gzipping.

like image 33
pwdst Avatar answered Sep 22 '22 06:09

pwdst