简体   繁体   English

检查通知是否已检查

[英]Check if notification has been checked

I have a javascript code that displays a notification on the home page of my asp.net website. 我有一个javascript代码,可在asp.net网站的主页上显示通知。

There is a function that hides the notification when a user clicks "X"; 当用户单击“ X”时,有一个隐藏通知的功能。 however, when the user browses to other pages and returns back to the home page, the notification is displayed again. 但是,当用户浏览到其他页面并返回首页时,将再次显示通知。

What's the best way to check if the user has already closed that notification the first time they opened the site? 检查用户是否在第一次打开网站时已经关闭该通知的最佳方法是什么? Any help is appreciated! 任何帮助表示赞赏!

(assuming "back" is back button) (假设“后退”是“后退”按钮)

You can do it via 2 ways ( at least) 您可以通过2种方式(至少)进行操作

1) set a cookie when he clicks the X , then when you back , you can check for a cookie flag. 1)当他单击X时设置一个cookie,然后当您单击时,可以检查cookie标志。

2) You can check the referrer and if the referrer is Page2 , then reponse.redirect to your self , where you'll loose the code which is saved in cache. 2)您可以检查引荐来源网址,如果引荐来源网址为Page2,则将reponse.redirect重定向到self,您将在其中释放保存在缓存中的代码。 youll get a new fresh page 您将获得一个新的新页面

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM