In the development of the background to upload pictures of the function of using Base64 preview pictures, resulting in a large number of images caused by Chrome crashes, the code is as follows
var New Image (); var New FileReader (); function (e) { = e.target.result; }; Render.readasdataurl (file);
I guess is in the number of pictures too much and the picture is too large, the browser in the resolution of the Base64 file when the consumption of too many resources caused the crash, so the replacement picture preview way as follows:
var New Image (); var New FileReader (); function (e) { varnew Blob ([E.target.result]); = (URL | | webkiturl). Createobjecturl (BLOB); }; Render.readasarraybuffer (file);
No longer use Base64, change to read the file binary, and then generate the resource link through Createobjecturl, which eliminates the base64 parsing process.
There are better ways to welcome a shot of bricks.
About image previews using Base64 on Chrome's performance problem solving method