Hi i have a popup script for blogger but ,i dont want it again to be apperaed once again when returning to homepage when he seen it before like it should present only once for the user
<b:if cond='data:blog.url == data:blog.homepageUrl'>
<div class='popup-overlay'>
<div class='popup-container'>
<div class='popup-close'>+</div>
<b> <h2 class='popup-title'>Welcome to Free Community!</h2></b>
<p class='popup-description'>
Hi,
Thank you for Visiting up for our Website. We appreciate your interest.
We will do our best to Bring you More Fun Videos for GTA 5 ,Thank You!
</p>
</div>
</div>
<script>
const popupOverlay = document.querySelector(".popup-overlay");
const popupClose = document.querySelector(".popup-close");
popupClose.addEventListener("click", () => {
popupOverlay.style.display = "none";
});
setTimeout(() => {
popupOverlay.style.display = "block";
}, 3000);
</script>
</b:if>
You can use the localStorage to have the user's browser save a value that will tell you if the user has already visited your site.
To save the value do localStorage["key"] = "value".
Show the popup only if localStorage["key"] != "value".
The full logic would be:
if (localStorage["key"] != "value") {
// show popup
localStorage["key"] == "value";
}