Reputation: 21694
I need to write to a text file using JavaScript. I have a machine I need to run some HTML file on and it uses JS to manipulate content. I want to log the changes the user makes in a text file, and the computer does not have and will never have any server-side scripting language. So I just wanna know how to append text to a txt file using JS only. Alternatively, running a batch script upon JS call that will do the work itself, is a good equivalent, but I'm sure it's the same level of difficulty...
The script will work on an IE only machine, but I need to be able to test it on other browsers as well... So I'm not sure how and if ActiveX works on Chrome for example, but if it doesn't, I need another solution... Help please! :)
Upvotes: 0
Views: 326
Reputation: 21694
Not exactly the solution I was looking for, but I ended up using cookies, which limits the amount of data I can hold to very little, but beats nothing.
Upvotes: 1
Reputation: 6124
While there's some promise with the new File API, you'll probably need to go with a server-sided language for reliable file-writing.
Some possible alternatives are to 'write' the changes to the localStorage
, or perhaps to create a URI
download. There's plenty of tutorials online for setting these up. Good luck!
Upvotes: 0