I'm working on a simple HTML/Javascript application. This application shows a random text message to the user in a text area. I have 15-20 such text messages of at most 500 characters. I don't want to save these messages in database. I have two scenarios -
- I have multiple .txt files for each message and then by using
javascript only to read a random txt file and display file's content
in textarea.
- User enters a message in a separate text area and by pressing save button, a new txt file for that message should be created.
I've been searching how to read / write files in javascript, I found these two posts -
Is it possible to write data to file using only JavaScript? and How to read and write into file using JavaScript.
But these posts are about reading file on client side or reading file from file input type.
https://stackoverflow.com/a/21012689/1930283
This suggestion is about using some server side language.
Is there any way to read and write txt files using Javascript only.