0

Some Javascript on a page gets a large wad of data from a server. At some point, I'd like to allow the user to click to download this data in, say, a format digestible to Excel.

My belief is that this will require the data to be on the server and re-fetched by the browser, but I am hoping that there's something I'm missing, and that there's some way for Javascript to get the browser to offer the 'save as' dialog to save away some content generated righ there.

bmargulies
  • 97,814
  • 39
  • 186
  • 310

1 Answers1

1

The data URI method is probably the most direct. Although there are alternatives, for example, https://github.com/dcneiner/Downloadify achieves this with flash. pimvdb's comment links to his nice HTML5 implementation.

Community
  • 1
  • 1
davin
  • 44,863
  • 9
  • 78
  • 78
  • @Sebas, everything is limited in size, and unless you're a clairvoyant, those limits might be acceptable. – davin Jun 03 '12 at 17:15
  • I don't know, if you want to save some megabytes it is really going to be a problem I think... – Sebas Jun 03 '12 at 17:22
  • This happens to look perfectly OK for me. If it's small enough to have the whole business in the browser, it's small enough to do this. – bmargulies Jun 03 '12 at 17:34