Are there any performance benefits using base64 encoded images?

For a small image, what (if any) advantage is when downloading using a base64 encoded image in a javascript file (or as a plain HTML file)?

$(document).ready(function(){
    var imgsrc = "../images/icon.png";
    var img64  = "P/iaVYUy94mcZxqpf9cfCwtPdXVmBfD49NHxwMraWV/iJErLmNwAGT3//w3NB";

    $('img.icon').attr('src', imgsrc); // Type 1
    $('img.icon').attr('src', 'data:image/png;base64,' + img64); // Type 2 base64
});
+5
source share
3 answers

, HTTP-, "" , . , , , , - ( , , ).

, HTTP- CSS . , , , (base64 1,33 ).

, : .

+14

, , HTML, :

<img src="bar.jpg" /> 

, . TCP/IP , , HTML . .

, jpg, P/iaVYUy94mcZxqpf9cfCwtPdXVmBfD49NHxwMraWV/iJErLmNwAGT3//w3NB

, - , - , .

, base64. , .

base64, , ( ) CSS Spirtes ( , , ).

base64, .

, , HTTP , - . , . , . - , , , ( , , ).

+2

.

src-, , .

base64, .

+1

All Articles