/    Sign up×
Community /Pin to ProfileBookmark

I had a nice little alert box on my homepage on April 1. It was a javascript prank for all my visitors. The problem, however, was everytime they went to the hoempage, it showed up again. Needless to say many of them were very annoyed.

Does any one know how to limit this to only the first time a user visits the homepage? It doesn’t have to be javascript; I’m willing to learn something new. I thought of making a duplicate of the homepage w/o the pop-up and having all the links point there, but that was TOO MUCH rewriting. I didn’t want to take the high chances of messing something up.

Any ideas?

to post a comment
Full-stack Developer

3 Comments(s)

Copy linkTweet thisAlerts:
@TiGGiApr 03.2006 — use cookies, you make cookie with value = "beenHere"

and on you message look for cookie and if it exist and value = beenHere then don't display message!

Here is tut on cookies:

http://www.quirksmode.org/js/cookies.html#ex
Copy linkTweet thisAlerts:
@felgallApr 03.2006 — See http://www.felgall.com/jstip64.htm for a script that tests if it is the first time the page has been viewed in the current session.
Copy linkTweet thisAlerts:
@brasspenguinsauthorApr 04.2006 — Thnx to both of you. I've been wanting to learn how to use cookies, and the second link makes this specific operation really simple. Muchas gracias!
×

Success!

Help @brasspenguins spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...