how to use cookies to store whether a particular announcement is show to user.
for example when we open stackoverflow for first time, it will show an announcement to read FAQ, if we close the announcement, the next开发者_如何学Go time we open the site the announcement won't shown. so this information is stored in cooki. am i correct?
any advice will be highly appreciated.
Thanks
Rifky
Yes.
You store a cookie, say named "announcement_seen".
Before displaying the announcement, you check the cookie value (on backend or front end, doesn't matter), and if it's 1, you don't display it.
When you DO display the announcement, you run a JavaScript on the browser to set the cookie value to 1.
精彩评论