Created
September 8, 2020 21:13
-
-
Save mcunha98/7dccbe3679a82d60c279794939de9787 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| function forceDownload(href) { | |
| var li = Math.max(str.lastIndexOf('/'), str.lastIndexOf('\\')); | |
| var bn = new String(str).substring(li + 1); | |
| var anchor = document.createElement('a'); | |
| anchor.href = href; | |
| anchor.download = bn; | |
| document.body.appendChild(anchor); | |
| anchor.click(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment