I was wondering if it is possible to keep some data even after refreshing the page. For example, I have values in my array and I don't want to lose them after refreshing the page.
Asked
Active
Viewed 536 times
1
-
If you add more information on your use case, we can better specify a solution for you. All the answers below will work, but some solutions are better than others depending on the scenario. – rkw Jul 24 '12 at 07:59
5 Answers
4
Use Cookies in javascript or the HTML5 localStorage,sessionStorage variable .
To use HTML5 LocalStorage, simply use it like variable preceded by localStorage.
localStorage.variable=['wrg','wg','wg'];
To use HTML5 sessionStorage, simply use it like variable preceded by sessionStorage.
sessionStorage.variable=['wrg','wg','wg'];
For more Info See Here

Community
- 1
- 1

bugwheels94
- 30,681
- 3
- 39
- 60
1
There is a trick w/ window.name in some browsers which allows to keep data even after refresh. Window name can store a json of your array.
window.name = "[JSON]";
BTW, Dojo implemented wrapper around window.name Dojo WindowName

Raman Zhylich
- 3,537
- 25
- 23