dwjohnston
dwjohnston

Reputation: 11900

Why can't you natively save files with javascript?

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.

Upvotes: 0

Views: 1072

Answers (1)

Simone Sanfratello
Simone Sanfratello

Reputation: 1620

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:

Upvotes: 1

Related Questions