HTML5 Object tag with base64 data content causes Chrome to crash

旧时模样 提交于 2019-12-01 09:14:52

You should highly consider using a blob URL instead of a data URL. You're not actually manipulating the bytes of the file, so there is no reason to read the entire file into memory, then add a 33% overhead of base64 encoding it as a data URL.

window.URL = window.URL || window.webkitURL;

var file = filelist[0];
var url = window.URL.createObjectURL(file);
var html = '';
if (file.type && file.type.match('image/.*')) {
  html += '<img src="' + url + '" />';
}
....
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!