使用MouseEvent在Firefox中发生多个文件下载崩溃

时间:2015-05-17 16:37:34

标签: javascript google-chrome firefox

使用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);

0 个答案:

没有答案