I'm trying to achieve auto refresh for 2 community pages and was able to get the result. But if a user writing something in anyone of the page like he is filling a forum at the time of filling current data is getting lost when it's refreshed. What we are looking is the data should be there even after the refresh also.


Why not store data in local storage?

Whatever attribute you get, you serialize it and store it in the local storage, and when the component is initialized check local storage has value and populate it.

localStorage.setItem("lastname", "Smith");//set
localStorage.getItem("lastname"); //retrieve 

Another option would be to use Browser cookie:

SRC : https://www.w3schools.com/html/html5_webstorage.asp

| improve this answer | |
  • If i use store data in local storage i can't delete it right? But in our scenario our total functionality is working in flow. Is there anything I can add to my component that (if a user writing something that particular block shouldn't get refreshed but entire pages can refresh). – Ranjith K K Jan 8 '19 at 19:58
  • You can delete from local storage, is it browser refresh you are talking about? – Pranay Jaiswal Jan 8 '19 at 19:59
  • No it's was community page refresh. – Ranjith K K Jan 8 '19 at 20:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.