Is it possible to write data to file using only JavaScript?

后端 未结 10 1310
梦如初夏
梦如初夏 2020-11-21 15:45

I want to Write Data to existing file using JavaScript. I don\'t want to print it on console. I want to Actually Write data to abc.txt. I read many answered que

10条回答
  •  盖世英雄少女心
    2020-11-21 15:56

    Some suggestions for this -

    1. If you are trying to write a file on client machine, You can't do this in any cross-browser way. IE does have methods to enable "trusted" applications to use ActiveX objects to read/write file.
    2. If you are trying to save it on your server then simply pass on the text data to your server and execute the file writing code using some server side language.
    3. To store some information on the client side that is considerably small, you can go for cookies.
    4. Using the HTML5 API for Local Storage.

提交回复
热议问题