Skip to content

Instantly share code, notes, and snippets.

@kolodny
Created December 16, 2013 16:33
Show Gist options
  • Save kolodny/7989963 to your computer and use it in GitHub Desktop.
Save kolodny/7989963 to your computer and use it in GitHub Desktop.
Create a client side download.
jQuery.download = function(data, filename) {
$('<a>').prop({
download: filename || '',
href: 'data:Application/octet-stream,' + encodeURIComponent(data)
})[0].click();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment