Notify user if there is something new in JavaScrip

2019-09-08 16:19发布

问题:

I would like to create something like this in Javascript, and its better if i can do it with Extjs:

showing a small notification icon on a button when the page contains something new, then when the user click this button and open the page, the icon gone.

It's simple HTML5/JavaScript. I update the web page weekly and would like users to notice the updates.

回答1:

This is possible. You have to save a Cookie in your browser once the user click the button. If the Cookie is set, then you can hide the notification.

Here an example:

var myCookie = Ext.util.Cookies.get("YourCookieName");
if(!myCookie){
    // show notification
}

And on button click:

Ext.util.Cookies.set("YourCookieName", 1);