i pushing values in array every 10 seconds being displayed innerhtml on div.
onreload or on visit other web page want display pushed content , content being pushed presently. have gone through local stroage , jstorage tutorials.
this doing precisely=:
localstorage.setitem('names', xyz);
i know how store 1 variable,but when have dynamic array being updated/10sec , data being pushed in every 10 seconds.how set , dynamic array when go other link.
if interested in code:http://jsfiddle.net/vccnb/
update 1----for simplification(ignore if have understood.) being displayed in div.page1 indicates page , 0,10,20 indicates time.
@ 10 seconds----[page1,0] [page1,10] @20 seconds-----[page1,0] [page1,10] [page1,20] click other page. @10 seconds----[page1,0] [page1,10] [page1,20] [page2,0] [page2,10] click other page. @20 seconds----[page1,10] [page1,20] [page2,0] [page2,10] [page3,0] [page3,10] [page3,20]
you can use json object
like,
localstorage.setitem('names', {'abc','xyz'}); //and on
or json string
like
var json={'abc','xyz'}; localstorage.setitem('names', json.stringify(json)); //and on
to get existing item try this,
console.log(localstorage.getitem('names'));
read https://developer.mozilla.org/en-us/docs/web/guide/dom/storage
Comments
Post a Comment