I have a very similar requirement specified here.
I need to have the user\'s browser start a download manually when $(\'a#someID\').click();
But
Firefox and Chrome tested:
var link = document.createElement('a');
link.download = 'fileName.ext'
link.href = 'http://down.serv/file.ext';
// Because firefox not executing the .click() well
// We need to create mouse event initialization.
var clickEvent = document.createEvent("MouseEvent");
clickEvent.initEvent("click", true, true);
link.dispatchEvent(clickEvent);
This is actually the "chrome" way solution for firefox (I am not tested it on other browsers, so please leave comments about the compilability)