使用JavaScript MouseEvent触发文件下载在Firefox中崩溃。但适用于Chrome。在Firefox中是否需要做一些不同的事情。或者在Firefox中还有另一种方法吗?
http://jsfiddle.net/katzmopolitan/L2mL5ktr/5/
var save = document.createElement('a');
save.href = fileURL;
save.target = '_blank';
save.download = "onion";
var evt = new MouseEvent('build');
evt.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
save.dispatchEvent(evt);
var save = document.createElement('a');
save.href = fileURL;
save.target = '_blank';
save.download = "onion";
var evt = new MouseEvent('build');
evt.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
save.dispatchEvent(evt);