One Time Popup (Session)
Perfect for daily announcements. This script ensures a visitor sees a popup only once during their current browsing session. If they close the browser and return tomorrow, they will see it again.
Click "Reset Session" to test it again without closing your browser.
Copy the Script
<script>
// Check if 'popShown' exists in session storage
if (!sessionStorage.getItem('popShown')) {
// 1. Show the popup
alert("Welcome! This is your one-time session message.");
// Or: window.open('promo.html', ...);
// 2. Set the flag so it doesn't show again this session
sessionStorage.setItem('popShown', 'true');
}
</script>
Frequently Asked Questions
Cookies can last for months. SessionStorage (used here) is deleted as soon as the user closes their browser tab or window, making this ideal for 'per visit' notifications.
No. SessionStorage survives page reloads. It only clears when the session ends (tab close).
Yes, just use different key names (e.g., 'hasSeenPopup1', 'hasSeenPopup2') in the storage command.