Created
January 27, 2016 00:15
-
-
Save crobinson42/b7c7981d8db355a5a570 to your computer and use it in GitHub Desktop.
This file contains 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
/* | |
This will create a file and trigger a download for the user. | |
*/ | |
var a = window.document.createElement('a'); | |
a.href = window.URL.createObjectURL(new Blob(['This is the text in the file..'], {type: 'text/html'})); | |
a.download = 'filename_test.html'; | |
// Append anchor to body. | |
document.body.appendChild(a) | |
a.click(); | |
// Remove anchor from body | |
document.body.removeChild(a) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment