Skip to content

Instantly share code, notes, and snippets.

@axlevisu
Created August 23, 2016 19:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save axlevisu/dd5cc946df506b2bf48e394e016a2069 to your computer and use it in GitHub Desktop.
Save axlevisu/dd5cc946df506b2bf48e394e016a2069 to your computer and use it in GitHub Desktop.
var list = document.getElementsByTagName('a');
for (i=1;i<list.length;i++){
var a = document.createElement('a')
a.href = list[i].href
a.text = "Download"
url = decodeURI(list[i].href)
a.download = url.substr(url.lastIndexOf('/')+1,url.length)
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment