Create client side javascript file

I want to implement dynamic creation of client files in javascript. Is it possible? For example, the user clicks a button and the script prompts you to download the generated file.

+2


source to share


3 answers


Impossible without a server side script that will return the correct mime type response.



+3


source


It depends on which file. You can generate an HTML file by opening a window and writing it; the user can upload it via File | Save as in most browsers.

A text file can be generated and loaded into an item textarea

, and then the user can either manually copy the file, or there are various ways to copy it to the clipboard (you could even keep it textarea

hidden and just offer a copy button). Search for "javascript clipboard" for different ways to do this; here is one of the first lnks that fit this part.



Binaries may have to be handled on the server side.

+1


source


You can always use FSO to create a text (binary does not work) on the client machine, return the link and download it.

Remember that it will only work for IE (ActiveX) and you will be asked to grant additional security rights.

Good luck.

0


source







All Articles