0

I'm trying to create a simple application, where the user enters some text in the a text field, clicks save, and then that prompts a save file dialog for them to save the text written in the text field to a .txt document.

From all the googling and looking at SO questions, I keep getting answers like

The question is - why is this basic functionality not allowed/not native?

I get that you don't want your browser covertly saving data, but an explicit save file dialog box seems harmless.

Community
  • 1
  • 1
dwjohnston
  • 11,163
  • 32
  • 99
  • 194
  • 1
    Why is an HTML5 (bad term, btw) solution not useful for you? – Ja͢ck Mar 06 '15 at 03:04
  • How would you prevent the browser from covertly saving data (like a cache, which it does)? Also, you can certainly open a url in a new window with javascript and use a content-disposition header to trigger a save... so your question is unclear... – Elliott Frisch Mar 06 '15 at 03:05
  • JS is not supposed to directly interact with client's file system – PM 77-1 Mar 06 '15 at 03:05

1 Answers1

1

You can't save files from browser to client filesystem, simply you can't. In the past VB script does (under IE), and VB script was the main vector for malware via web.

If you really need manage client files, consider write a desktop application, not a web application, keep in mind on web applications you are stuck in same kind of sandbox.

You can do other surrogate for "saving" files to client:

Simone Sanfratello
  • 1,520
  • 1
  • 10
  • 21