Removing an item in HTML5 Local Storage after a period of time?

前端 未结 4 1107
悲&欢浪女
悲&欢浪女 2021-02-07 14:31

I have a simple HTML5 App that I am currently working on and I\'m wondering if it\'s possible to remove a item in HTML5 Local Storage after a period of time, like: after 24 hour

4条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-07 14:55

    window.setInterval(function () {
            localStorage.setItem('nicwincount', 0);
    },8640000); //24 * 60mins * 60sec
    

    ps: nicwincount is a localstorage you set before. localStorage.setItem('feeds', Ext.encode(feeds));

    hope can help you.

提交回复
热议问题