1

I have a web page which shows some data. I would like to give the user the ability to export that data they see as CSV files or PDF files or other formats.

is it technically possible to do so purely by javascript ?

Thanks

Zo72
  • 14,593
  • 17
  • 71
  • 103
  • Try DataTable [Table Tools](http://datatables.net/extras/tabletools/), its flash/jquery cambo. – Emmanuel N Nov 06 '12 at 13:33
  • http://stackoverflow.com/questions/3665115/create-a-file-in-memory-for-user-to-download-not-through-server – Viktor S. Nov 06 '12 at 13:34
  • @FAngel thanks I did not realize somebody else had asked something similar thanks – Zo72 Nov 06 '12 at 13:43
  • The question is a duplicate of this: http://stackoverflow.com/questions/3665115/create-a-file-in-memory-for-user-to-download-not-through-server – Zo72 Nov 07 '12 at 09:23

1 Answers1

0

To a certain extent this can be resolved:

here is a link which triggers a 'save as' download:

<a href="data:application/octet-stream;charset=utf-8;base64,Zm9vIGJhcg==">text file</a>

so the trick is to use data:application/octet-stream;

note however that it is not possible to specify the extension of the filename/resource you would save (e.g. report.csv)

Zo72
  • 14,593
  • 17
  • 71
  • 103