The file, once parsed, will open remote access to the user machine. Unfortunately, this solution doesn't work as expected.
At first, I came up with a simple solution that is making tag linked with the URL of the file, and add download attribute to that tag. This behavior is determined by the binary itself. Method 1 - make tag with download attribute, simply - but it doesn't work as expected.On PC the downloaded file is an executable.Mac-Chrome will save the file as a zip, at which point the user must unzip and execute its contents.On Mac and Safari, the file simply opens an application.The binary itself should behave differently depending upon os and browser.
#Javascript download string as file code#
The JavaScript code will be able to extract the text from any text file and display it in script.js. We're attempting to take a binary string and output a download url. Example: In this example we will just create a text area where the text will appear from the text file that has been used as an input in the index.html.