javascript code to save a txt file

后端 未结 6 1116
走了就别回头了
走了就别回头了 2021-01-06 12:50

can any body tell me how i create a .txt file using javascript which is browser compatable too.

and after creating the file it gives the save as diaglog box so that

6条回答
  •  走了就别回头了
    2021-01-06 13:46

    For a great example of how to do this, look at TiddlyWiki which implements a single user wiki in Javascript. It supports all the major browsers and in each will save a copy of itself to the local disk.

    It uses the FileSystemObject in IE (as described previously in this question) The best info for file saves in FireFox is https://developer.mozilla.org/en/Code_snippets/File_I%2F%2FO

    For Chrome, Opera & Safari is uses a little applet:

    The TiddlySaver Java applet allows TiddlyWiki to save changes in a local version (from a file:// URL) of Safari, Opera and other browsers.

提交回复
热议问题