View Full Version : Help with pop up window script

07-07-2003, 06:06 PM
I am using the following script on my site to load a popup ad.. However I want it to open only once...Not every visit to the page.. How do I configure the script to do this?

Here it is -


//Popup Window Script
//By JavaScript Kit (http://javascriptkit.com)
//JavaScript tutorials and over 400+ free scripts

function openpopup(){
var popurl="ccad.html"

function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { // if cookie exists
offset += search.length
// set index of beginning of value
end = document.cookie.indexOf(";", offset);
// set index of end of cookie value
if (end == -1)
end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
return returnvalue;

function loadornot(){
if (get_cookie('poppedup')==''){


07-07-2003, 06:13 PM
That should work if they don't close their browser down, open it back up and go to the page. The script sets a cookie so that is won't open up again within the same browser session. Is that not working?

07-07-2003, 07:15 PM
Yes it is working for the session but I do not want a session cookie I want it show only once ever and then not again...

07-07-2003, 07:57 PM
You will need to add an expiration date to the cookie. try this link for an explanation on how to do it:

It is old, but still relavent.

07-07-2003, 08:16 PM
Thanks for the information - the one page ont he site keeps crashing my browser...

How would I configure the code that I have? Or would I have to use a totally different script?

Thanks for all your help!

07-08-2003, 02:47 AM
I wouldn't use pop-ups...Everybody is turning them off. :D