Continual counter regardless of page refresh

后端 未结 5 1800
不知归路
不知归路 2021-01-13 17:14

I have this piece of jQuery that currently increments a number by one every 5 seconds. The problem I have is that its client side, therefore it resets every time you refresh

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-13 17:49

    Can you store counter in cookie.

    document.cookie = counter.
    

    so you can get last value from cookie, if user refresh the page.

提交回复
热议问题