84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
如题,我们使用IndexedDB缓存了用户打开的mp3文件,是以blob形式存的。现在我们想做一个“导出”功能,让用户可以把这个mp3文件导出成普通的样子,就像下载一个Mp3那样,请问该怎么做?
认证高级PHP讲师
function fake_click(obj) { var ev = document.createEvent('MouseEvents'); ev.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); obj.dispatchEvent(ev); } function export_raw(name, data) { var urlObject = window.URL || window.webkitURL || window; var export_blob = new Blob([data]); var save_link = document.createElementNS('http://www.w3.org/1999/xhtml', 'a') save_link.href = urlObject.createObjectURL(export_blob); save_link.download = name; fake_click(save_link); }
给你段代码,你试下
给你段代码,你试下