tags:

views:

59

answers:

3

So I had a thought today. I generate CSV from data already in memory in my JavaScript application, then pump that data to the user's browser via a File download prompt -- all in JavaScript --.

Is this possible?

A: 

No.

You need a server application too.

Ghommey
A: 

If your server is setup to trigger a download for your given MIME type then you can simply do a straight location.href = 'myFile.csv'.

This will prompt the user to open or save the file as you'd like.

This does require that your server be configured to behave this way.

Jamie Dixon
+1  A: 

If you want to do it entirely on the client-side, without any server interaction, you will need at least the help of Flash.

Give a look to Downloadify, is the best I've seen for client-side file generation.

Check the demo.

CMS
Excellent, thank you very much.
Drew
Accepted answers with 0 votes look silly .. Here's one.
BalusC
@BalusC, thanks!, you are right, it's simply a JavaScript *proxy* API to ActionScript.
CMS