[英]Why local storage is not working even it should not open after page refresh?
I am using this but the cookies message keeps appearing after everypge refresh and tab opening. 我正在使用它,但是cookie消息在每次刷新和打开选项卡后仍然出现。
$(document).ready(function () {
if (!!localStorage.getItem('firstVisitVisp')) {
localStorage.setItem('firstVisitVisp', 'true');
setTimeout(function () {
$("#cookieConsent").fadeIn(200);
}, 4000);
$("#closeCookieConsent, .cookieConsentOK").click(function () {
$("#cookieConsent").fadeOut(200);
});
}
});
You're nearly there - just remove the !!
您快到了-删除
!!
and change it to !
并将其更改为
!
: :
if (!localStorage.getItem('firstVisitVisp')) {...}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.