Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function download(filename, text) {
- let element = document.createElement('a');
- element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
- element.setAttribute('download', filename);
- element.style.display = 'none';
- document.body.appendChild(element);
- element.click();
- document.body.removeChild(element);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement