Can I store some data in a file created by JavaScript in web page and retrieve data anytime from JavaScript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can I store some data in a file created by JavaScript in web page and retrieve data anytime from JavaScript

21st Aug 2018, 10:30 AM
Shubhendra Kushwaha
Shubhendra Kushwaha - avatar
3 Answers
+ 2
No, JavaScript codes are not allowed to create and read any files. Use localStorage.setItem localStorage.getItem to store/read all the persistent data of a local device.
21st Aug 2018, 10:51 AM
Calviղ
Calviղ - avatar
+ 1
Use localStorage or cookies. But localStorage will not work in the Soloearn App due to security restrictions, you may test it in webbrowser. If cookies work here i dont know, havent tested it myself.
22nd Aug 2018, 2:29 AM
Rainer Wess
Rainer Wess - avatar
0
localStorage is a good option it.
22nd Aug 2018, 1:25 AM
Mr Genesis
Mr Genesis - avatar