Notify user if there is something new in JavaScript [closed]

时光总嘲笑我的痴心妄想 提交于 2019-12-25 01:55:49

问题


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);


来源:https://stackoverflow.com/questions/16728965/notify-user-if-there-is-something-new-in-javascript

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!