How useful is this practice today?
Portability . In some cases you need to ensure that the feature is available in any situation: If your HTML content is dynamically generated offline, without internet access, or operating on a protocol (HTTPS for example) that does not allow you to access features in hybrid mode .
One example is the Chrome URLs , where all the images present are base64:
Try some of these URLs in Chrome:
chrome: // ipc
chrome: // inspect
chrome: // media-internals
chrome: // memory
There is some gain in terms of performance over
store / transmit binary data in their original formats (in this case
case, bitmap)?
In practice, difference is negligible . Once your content is cached, it is handled in the same way by modern browsers, whether it is a response to a GET
or a base inline interpretation.
(It's worth mentioning that if you're embedding base64 content in a dynamically generated page you'll be resubmitting content to each request.)
When stored locally, we must use bitmap or string
base64?
If by locally you mean the browser, there is no reason to worry about it.
If you want to tell the server, this depends on your implementation strategy; remember that all atomic file change (containing HTML / CSS + base64) will imply a cache flush / refresh .
When is it good practice to use bitmap? E string base64?
The most commonly used binary formats (JPEG, PNG) use fewer bytes than a base64 string, but this difference is only felt in an access with the cache still empty.
If you are storing a large amount of images or viewing only a small set in the collection, use binary files.
If your application uses few bitmap graphics or needs to run in offline mode , base64.