Previously, I talked about how to use external resources to minimize server load. CSS compresses small files by merging and JavaScript to accelerate server response time.
Previously, I talked about how to use external resources to minimize server load. CSS compresses small files by merging and JavaScript to accelerate server response time, I saw an article on the website loading images in the form of a stream, which is several times faster. MXHR technology is used. MXHR is called Multipart XMLHttpRequest. It allows the client to transmit multiple resources from the server to the client using only one HTTP request. This saves a lot of time, because HTTP requests are time-consuming. In this example, only one HTTP request is made for all images, not one request for each image. Therefore, the loading speed can be increased by 3-5 times theoretically. For the last pure HTML and JS code generation, PHP is also used in the background. Use PHP to read images and convert them to base64 encoding. It should be noted that for the img label src, it not only supports direct image path writing,
Mxhr reduces the number of HTTP requests, but there are also browser restrictions. because xmlhttp requests in IE6 and 7 do not support 3 readyState and do not support images:
Img. src = 'data: image/png; base64, '+ imageData;
The following is an online instance. how to load images using JS + PHP real stream? mxhr php instance