0

Does HTML 5 allow to invoke save file dialog with file created in JavaScript?

Alexey Zakharov
  • 24,694
  • 42
  • 126
  • 197
  • 1
    It's unclear what you are asking about. Please provide more info about your scenario. – marcind Feb 19 '11 at 21:15
  • 2
    How do you create a file with Javascript? – mikerobi Feb 19 '11 at 21:16
  • 1
    I believe @Alexey is asking how to create content in Javascript that the user can save as a normal file. Specifically without requiring the content to traverse through a server. Or at least, that's the question I would like an answer for :-) – kanaka Feb 19 '11 at 21:24

2 Answers2

0

Yes, but you don't really need HTML5 for it, what you can use is a Data URI. There are several limitations, like IE8 only allows files up to 32Kb, and you'll need to get the user to click on a link. See my answer to a similar question for an example.

In the future you may be able to use the File Writer API, but I'm not aware of any browser support for that yet.

Community
  • 1
  • 1
robertc
  • 74,533
  • 18
  • 193
  • 177
0

I've tested data-uri approach. Currently it works only in Firefox.

Seems that for now it is better to stay with flash: https://github.com/dcneiner/Downloadify

Alexey Zakharov
  • 24,694
  • 42
  • 126
  • 197