Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function download(url, name) {
- name = name || 'file'
- var link = document.createElement('a');
- link.setAttribute('download', name);
- link.href = url;
- link.onclick = function () {
- document.body.removeChild(this);
- };
- link.style.display = 'none';
- document.body.appendChild(link);
- link.click();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement