"Don't Show Again" button -JS/Cookie?

I'm looking for a script that will allow me to add a "Don't Show Again" button to an onUnload subscription offer (pop-up). I'd like it so that the  "Don't Show Again" script will load a cookie that will expire in three months so the notice will begin showing again.

The pop-up can be seen at http://www.thecatholicworld.com. Once you're on the page, leave it and the pop-up will (should) appear.

Here's the code for the pop-up:

<TITLE>Subscription Request</title>

<link href="global.css" rel="stylesheet" type="text/css">


<BODY bgColor="#CCCCCC">


<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">

<TR><TD align="center" valign="middle" height="100%">

<p class="serif_Geo fs_16 burg bold cent mT_0 mB_20">
Thank You!</p>

<p class="serif_Geo fs_13 blue cent mT_8 lH_18 width_400"> We hope you found your visit to<br>
<span class="burg bold fs_13">The Catholic World</span><br>enjoyable & informative. Before leaving we would like to invite you to subscribe and receive bi-monthly updates. All that  is needed is your name and email address.</p>

 <input type="hidden" name="redirect"
        value="thank_you.htm" target="new" />
         <input type="hidden" name="required" value="" />
            <input type="hidden" name="recipients" value="cayce@paulistpress.com,mkerrigan@paulistpress.com" />
          <input type="hidden" name="missing_fields_redirect"
        value="../form_error/form_error.html" />
         <input type="hidden" name="subject"
        value="TCW Subscription" />
<input type="text" id="first_name" name="First_Name" size="15" maxLength="50" value="[First Name]" onFocus="if (this.value=='[First Name]') this.value = '' ">
<input type="text" id="last_name" name="Last_Name" size="15" value="[Last Name]" maxLength="50" onFocus="if (this.value=='[Last Name]') this.value = '' "<br>
<input type="text" id="email" name="email" size="30" value="[E-Mail Address]" maxLength="50" onFocus="if (this.value=='[E-Mail Address]') this.value = '' "<br>

<input type="submit" id="subscribe" name="subscribe" value="Subscribe" class="burg fs_10 mT_6">
<input type="button" id="noThanks" name="noThanks" value="No Thanks" class="burg fs_10 mT_6 mB_12" onClick="window.close()">


Thanks for any and all help.

Who is Participating?

Cookies would be fine...

You can use the cookie code here :


With a few tweaks you can make it do what you desire...

note, you'd be better off checking the cookie BEFORE you popup the window, rather than checking it in the popup itself
so on the popup window you can add  this to the head:

<script type="text/javascript">
function setCookie(c_name,value,expiredays)
      var exdate=new Date()
      document.cookie=c_name+ "=" +escape(value)+
      ((expiredays==null) ? "" : ";expires="+exdate.toGMTString())

and add this button:

<label for="dontbugme">Don't ask me again</label>
<input id="dontbugme" type="checkbox" onclick="setCookie(this.id, this.checked, 90);"/>

Then, before you open the popup window you can check the "dontbugme" cookie.
you could use code like this to prevent the popup:

<script type="text/javascript">
function checkPopup()
 var dontbugme = getCookie('dontbugme');
 if(!(dontbugme == "true" || dontbugme == true))

function getCookie(c_name)
   c_start=document.cookie.indexOf(c_name + "=");
   if (c_start!=-1)
    c_start=c_start + c_name.length+1
    if (c_end==-1) c_end=document.cookie.length
    return unescape(document.cookie.substring(c_start,c_end))
  return ""

you would call it like this:
<body onunload="checkPopup();">
Forced accept.

EE Admin
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.