Display alert only once

后端 未结 3 1488
说谎
说谎 2020-12-16 05:14

I have this code that shows alert when it\'s 30 minutes before event in calendar but I want to show it only once when user comes to page (in that 30min). Now it shows on eve

3条回答
  •  庸人自扰
    2020-12-16 05:38

    Set a cookie when you show the alert. Then, if the cookie is set, you will know not to show the alert again. If it is not set, you know that you haven't shown the alert yet and should do so now.

    You can read about setting cookies in JavaScript here.

提交回复
热议问题