localStorage content with time stamp to remove itself
问题 I would like to have a timer for content in localStorage. For example I have got a dynamically updated DIV <div id="news"><p>test</p></div> And managed to add it as html block to localStorage by using this code: $(function() { localStorage["homeNews"] = JSON.stringify($("#news").html()); }); $(function() { if (localStorage["homeNews"] != null) { var contentsOfNews = JSON.parse(localStorage["homeNews"]); $("#news").html(contentsOfNews); } }); I need to add a time stamp to the localStorage[