How can JavaScript save to a local file?

后端 未结 7 1299
渐次进展
渐次进展 2020-12-29 08:27

There\'s already a solution for writing file JSON online but I want to save json file locally. I\'ve tried to use this example http://jsfiddle.net/RZBbY/10/ It creates a lin

相关标签:
7条回答
  • 2020-12-29 09:27

    So, your real question is: "How can JavaScript save to a local file?"

    Take a look at http://www.tiddlywiki.com/

    They save their HTML page locally after you have "changed" it internally.

    [ UPDATE 2016.01.31 ]

    TiddlyWiki original version saved directly. It was quite nice, and saved to a configurable backup directory with the timestamp as part of the backup filename.

    TiddlyWiki current version just downloads it as any file download. You need to do your own backup management. :(

    [ END OF UPDATE

    The trick is, you have to open the page as file:// not as http:// to be able to save locally.

    The security on your browser will not let you save to _someone_else's_ local system, only to your own, and even then it isn't trivial.

    -Jesse

    0 讨论(0)
提交回复
热议问题