+ 1
How to save elements after refresh in web?
I made a to do list in which it takes the value of the input and createElement('p' ) and a checkbox and everything is going fine till now but after i refresh the site all the created elements are gone i was told i should use local or session storages Do any body have a similar code or anything that could help?
6 Antworten
+ 3
bell I see. But at least MDN is a pretty good resource and provides many examples.
I've done a little research myself and as expected it doesn't work on Sololearn (at least on mobile). Local and session storage can only be reasonably used in combination with websites and it just doesn't make any sense to enable this feature in the web view, especially since Sololearn allows to run all sorts of web based codes and couldn't tell which storage belongs to whom.
+ 3
Aaron Eberhardt I agree MDN is a good site, I also use it and stackoverflow, and geeksforgeeks and so on. But you see, their test code pasted here in the playground outputs localstorage is working so it is not the whole story. you will not read about the system side there. I had posted a similar question today and have little hope it will get an answer. Not to say I have not got lots of useful insight in sl, from you also, but rarely in this section, mostly in code comments.
+ 2
Aaron Eberhardt getting just a link to documentation is of limited utility: I am looking into this same problem and while I have read the documentation, it is not clear to me yet if and how it works in SL.
I am experimenting with this code with a test saying yes but not yet succeeding to save values.
https://code.sololearn.com/Wao7nBDbuTey/?ref=app
+ 2
Aaron Eberhardt yes! I get the pop up with yippie, it is working. i am using an ipad. I am trying to make it work on textastic (also passes the test), but not sure it will. Maybe is the test that does never generate an error on ios in the try / except?
+ 1
bell wait a minute, you pasted the example code and it worked!? That's interesting... on my Android it says localStorage is not allowed to be used in the console. But if it worked on your device that could mean it actually works...