Friday, August 28, 2009

ThickBox Cookie Control How To Make it only Show up once

How to make ThickBox only show up the first time on your web site with cookie control.

As stated in my previous post I have been diligently working on this LightBox / ThickBox implementation for a client. Banging my head against the keyboard for several days. But its working now.

Here is what you need if you want your Box (LightBox / ThickBox / what ever implementation..)to only show up the first time someone hits your site.

First you will need a file off of just right click the link and save as:


Place this file in you public directory my folder name is /js

Just make sure you remember where it is at. because you will need to referance that later in your site code.

then here is my example

Place this line of code in the <head> of you site

<script type="text/javascript" src="js/jquery.cookie.js"></script>

After <body> somewhere here is the implementation for the pop-up with cookie control

<script type="text/javascript">
if ($.cookie('guest') != '1') {
tb_show("Coupon","***WHATEVERYOUR PAGE***.html?height=490&width=380");
$.cookie('guest', '1', { expires: 2 });

Where as the 'guest' is just the name of the cookie (I guess.. lol)

!='1' is the limitation on how many times it will show up.

{ expires: 2 } is the days it will take before it shows up again on that persons computer.

Hope this helps someone out there ...


Thanks my friends. I will test it on some functionality in one of the site where I am developing (

Can i download the source files?

I am a web designer in Japan.
I want the same thing with you, was looking for information.
Thanks to your help, was very helpful.
Thank you very much.

(For automatic translation, I'm sorry when the sentence is wrong.)

Lone Star Custom Lapel Pins

Lone Star Custom Lapel Pins
Veteran Managed Lone Star Pins are creators of custom lapel pins. We offer a free digital how to PDF on our site, Free Artwork, and quote. Contact us today for your proof and quote.


Twitter Delicious Facebook Digg Stumbleupon Favorites More