Created
April 30, 2015 18:45
-
-
Save JavaScript-Packer/591d504b38dc5be6d7eb to your computer and use it in GitHub Desktop.
Make a JavaScript source code into a download link using blobs. Click link to download.
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
| //make a javascript source code downloadable by blob | |
| var name="script.js",data="alert('THIS IS A TEST');",d="download",$="setAttribute",_=document, | |
| r=new Blob([data],{type:"text/plain;charset=utf8;"}),e=_.createElement("a"); | |
| void 0!==e[d]?(e[$]("href",window.URL.createObjectURL(r)), | |
| e[$](d,name)):e[$]("href","http://www.whak.com"),e.innerHTML="Download",_.body.appendChild(e); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment