Created
November 6, 2013 03:33
-
-
Save phamquocbuu/7330466 to your computer and use it in GitHub Desktop.
JS Save a file from a URL with JavaScript http://ausdemmaschinenraum.wordpress.com/2012/12/06/how-to-save-a-file-from-a-url-with-javascript/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = document.createElement('a'); | |
a.download = filename; // Set the file name. | |
a.style.display = 'none'; | |
document.body.appendChild(a); | |
a.click(); | |
delete a; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you are missing a.href = "URL to download"