dynamic download filename
by Ariel Balter
HTML
<button>Set url and download name for anchor</button>
<a href="" download="">Download Google logo</a>
JavaScript
var googleLogoURL = "https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png";
$('button').on('click', function(){
alert("url and filename set");
$('a').prop({
'href': googleLogoURL,
'download': "google-logo.png"
});
});