[英]Auto popup based on JavaScript/jQuery cookie
我正在嘗試在依賴於js / jQuery cookie的網站上添加自動彈出消息,這意味着該彈出窗口每天僅向訪問者顯示一次(而不是每次重新加載頁面時都顯示)
Cookie將在24小時后過期,一旦過期,自動彈出窗口就會再次顯示。
非常感謝
偽代碼:
var currentDate = new Date().toLocaleString();
var alertCookieDate = getCookieDate();
var alertWasShown = getCookiePopup(); //set here boolean if popup was shown on true and false if not
if(alertCookieDate < currentDate && !alertWasShown){
alert("popup here");
updateCookie(); //code to update time here;
updateCookiePopup(); //set boolean here
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.