Javascript Image popup on accessing home page of Website

Shady40

Well-Known Member
Joined
Nov 29, 2010
Messages
226
Reaction score
10
Location
Somewhere Close by
Hi there all.
Does anyone have a Javascript code to popup an image as soon as you enter my website?
It must have the option obviously for the person accessing my site to close it.
I just want it to pop up the image the first time you access the main page and then not to pop up
again after that until you exit the website and re-enter it.

Thanks in advance to anyone with any info in this regard.:)
 
Google lightbox for plenty of solutions regarding the pop-up. Take your pick from the results.

Regarding the once-only nature of the pop-up - you can either use cookies, or check the HTTP-REFERRER domain, and show if not your domain. That's what I'd do, anyway.

Why do you want to show it every time someone visits the site? (One time I can understand...)
 
Hmmm. Easy to get the image to pop up on page load the first time, set a cookie and check if it's set before allowing the pop up again, but how to clear the cookie when someone exits the site?
 
Hmmm. Easy to get the image to pop up on page load the first time, set a cookie and check if it's set before allowing the pop up again, but how to clear the cookie when someone exits the site?

Maybe set the cookie to expire the next day? That way the visitor would only be bombarded with (what I assume to be) the ad once a day.
 
If it's a different image every day, you could set a flag in the cookie to check if the current image is the same as the last one seen. If not, show and set cookie.
 
Or forget cookies and do it session based?
 
Or don't annoy your visitors and forget about the pop up ad.
 
Top
Sign up to the MyBroadband newsletter
X