Skip to content

Instantly share code, notes, and snippets.

View chrisseto's full-sized avatar

Chris Seto chrisseto

View GitHub Profile
@jmcarp
jmcarp / forceDownload.js
Created March 1, 2014 15:35
Forcing a file download in JavaScript
function forceDownload(href) {
var anchor = document.createElement('a');
anchor.href = href;
anchor.download = href;
document.body.appendChild(anchor);
anchor.click();
}