Want Pop-Up To Show Only Once Per Visit Per Day

by Dele
8 replies
Hi Warriors,

I have some code for a pop-up which i inserted in the tpl_header file of my site but it makes the pop-up to display on all webpages of the site all the time until either clicked away or the seconds i set for it expires. Clicking to another webpage on the site makes the pop-up show up again etc.

I want the pop-up to show only once per visit per day. I understand that can be achieved with the use of cookies and javascript or is it JQuery?.

Specifically, what code do i need to add and to what file, to achieve the desired objective?

Your assistance is much appreciated in advance.

Thanks.
#day #popup #show #visit
  • Profile picture of the author FirstSocialApps
    How is anyone suppose to answer this when you dont provide the starting code.

    Hey I have a thing and I want to change it so what do I have to add to my thing so I can have my thing work differently?

    That being said a general answer would be to add some JS to set a cookie inside
    whatever function triggers the pop up.

    $.cookie("wasshown", 1);

    Then wrap that all the code in that function inside a JS if

    if ($.cookie("test")!="1"){
    // popup function
    }

    **Example code uses JQUERY
    {{ DiscussionBoard.errors[7323987].message }}
    • Profile picture of the author Dele
      Thanks FirstSocialApps.,You know not all of us are computer geeks as to know exactly how to better get help in such circumstances

      I present below the full code as you advised, perhaps it will help me receive more specific guidance.Thank you.

      Code:
        <!-- Free popup script start (http://popup-toolkit.com) --><TABLE id='v17104504d6' style='display:none;position:absolute;empty-cells:hide;border-width:2px;border-style:solid;border-color:#09FF2C #00BF00 #00BF00 #09FF2C' border='0' cellspacing='0' cellpadding='0' onSelectStart='return false;'><COLGROUP><COL width='1px'><COL><COL width='1px'><COL width='1px'></COLGROUP><TR style='background:#52F040' onMouseDown='v18104504d6(event);' onMouseUp='v19104504d6(event);'><TD style='width:16px;height:16px;cursor:pointer;background-color:#7060DE;padding:0px'><A href='http://popup-toolkit.com/' title='put pop up ad' target=_blank style='text-decoration:none'><DIV style='width:16px;height:16px;overflow:hidden;cursor:pointer;font-family:Tahoma;font-weight:bold'>put pop up ad<IMG id='img_id' src='http://' width=1 height=1></DIV></A><TD style='border:none;text-align:left;height:30px;color:#FA0505;font-family:Tahoma,sans-serif;font-size:15pt;font-weight:bold;padding:1px 1px 1px 2px;cursor:default'>Welcome To RECHARGE CARDS ONLINE(A HOMEBIZ-SUPERMARKET Business)<TD id='v1a104504d6' style='border:none;cursor:default;vertical-align:top;padding:1px' onclick='v1b104504d6();'><DIV style='padding:1px;margin:0px;line-height:10px;font-family:Tahoma,sans-serif;font-size:10pt;overflow:hidden;border:outset 2px #FFFFFF;width:11px;height:11px;color:#000000;background-color:#E0E0E0;font-weight:bold'><DIV style='padding:0px;margin:0px;line-height:10px;font-family:Tahoma,sans-serif;font-size:10pt;overflow:hidden;border-style:solid;border-color:#000000;border-width:0px 0px 2px 0px;width:10px;height:8px;color:#000000;background-color:#E0E0E0;font-weight:bold'>&nbsp;</DIV></DIV><TD id='v1c104504d6' style='border:none;cursor:default;vertical-align:top;padding:1px' onclick='v1d104504d6();'><DIV style='padding:1px 1px 1px 2px;margin:0px;line-height:10px;font-family:Tahoma,sans-serif;font-size:10pt;overflow:hidden;border:outset 2px #FFFFFF;width:10px;height:11px;color:#000000;background-color:#E0E0E0;font-weight:bold'>X</DIV><TR id='v1e104504d6'><TD colspan='4' style='padding:0px'><TABLE cellspacing='0' cellpadding='0' border='0' style='width:100%;height:100%;background-color:#FAFAFA'><TR><TD id='v1f104504d6'><TR><TD style='height:1px;text-align:center'><BUTTON type='button' style='cursor:pointer;font-family:Verdana,sans-serif;font-size:8pt;line-height:8px;height:18px' onclick='v1d104504d6();'>Close</BUTTON></TABLE></TABLE><SCRIPT language='JavaScript' type='text/javascript'>var v20104504d6=document.getElementById('v17104504d6');var v21104504d6=document.getElementById('v1e104504d6');var v22104504d6=document.getElementById('v1f104504d6');var v23104504d6=true;var v24104504d6;var v25104504d6;var v26104504d6;var v27104504d6;var v28104504d6=false;var v29104504d6=navigator.userAgent.indexOf('Opera')!=-1;var v2a104504d6=navigator.userAgent.indexOf('Chrome')!=-1;var v2b104504d6=!v2a104504d6&&navigator.userAgent.indexOf('Safari')!=-1;var v2c104504d6=!v29104504d6&&!v2a104504d6&&!v2b104504d6&&document.charset?true:false;var v2d104504d6=false;var v2e104504d6=navigator.userAgent.indexOf('Firefox')!=-1;var v2f104504d6=document.compatMode=='BackCompat';var v30104504d6='<html>rn<head>rn<metax20content="text/html;x20charset=ISO-8859-1"rnhttp-equiv="content-type">rn<title>pop-up-content</title>rn</head>rn<body>rn<divx20style="text-align:x20center;"><bigx20style="font-weight:x20bold;"><br>rnGotx20"<bigx20style="color:x20rgb(204,x20102,x20204);">Greyx20Areas</big>"x20tox20clear?<br>rn<br>rn&nbsp;rn<bigx20style="color:x20rgb(51,x20204,x200);">Questions</big>x20andx20<bigrnstyle="color:x20rgb(51,x20204,x200);">Comments</big>x20<br>rn<br>rnarex20welcomex20from<br>rn<br>rn&nbsp;<bigx20style="color:x20rgb(255,x20102,x20102);">Members</big>x20andx20<bigrnstyle="color:x20rgb(255,x20102,x20102);">Visitors</big><br>rn<br>rnatx20</big>rn<br>rn<ax20href="http://www.homebiz-supermarket.com/forum"><imgrnstyle="border:x200pxx20solidx20;x20width:x20125px;x20height:x2070px;"rnalt="Clickx20Underx20Now!"rnsrc="http://www.homebiz-supermarket.com/images/wavinghand.gif"></a><br>rn</div>rn<divx20style="text-align:x20center;"><big><spanx20style="font-weight:x20bold;">Thern<ax20href="http://www.homebiz-supermarket.com/forum"x20target="_blank"><bigrnstyle="background-color:x20yellow;"><big><big>FORUM</big></big></big></a></span><arnhref="http://www.homebiz-supermarket.com/forum"x20target="_blank"><bigrnstyle="background-color:x20yellow;"><big><big><big><big><spanrnstyle="color:x20yellow;"></span></big></big></big></big></big></a></big><br>rn</div>rn</body>rn</html>rnrn';var v31104504d6,v32104504d6;v22104504d6.innerHTML=v30104504d6;v33104504d6(-1000,0);v34104504d6(500,300);v35104504d6();setTimeout('v36104504d6();',1.5*1000);function v37104504d6(){return parseInt(v20104504d6.style.width);}function v38104504d6(){return parseInt(v20104504d6.style.height);}function v39104504d6(){return parseInt(v20104504d6.style.width)+parseInt(v20104504d6.style.borderWidth)*2;}function v3a104504d6(){return parseInt(v20104504d6.style.height)+parseInt(v20104504d6.style.borderWidth)*2;}function v3b104504d6(){if(!v2f104504d6)return document.documentElement.clientWidth;else return document.body.clientWidth;}function v3c104504d6(){if(!v2f104504d6)return document.documentElement.clientHeight;else return document.body.clientHeight;}function v3d104504d6(){if(v2c104504d6)if(document.documentElement&&document.documentElement.scrollLeft)return document.documentElement.scrollLeft;else return document.body.scrollLeft;else return window.pageXOffset;}function v3e104504d6(){if(v2c104504d6)if(document.documentElement&&document.documentElement.scrollTop)return document.documentElement.scrollTop;else return document.body.scrollTop;else return window.pageYOffset;}function v1b104504d6(){if(v20104504d6.v3f){v21104504d6.style.display='';v20104504d6.style.height=v20104504d6.v40;v20104504d6.v3f=false;}else {v21104504d6.style.display='none';v20104504d6.v40=v20104504d6.style.height;v20104504d6.style.height='30px';v20104504d6.v3f=true; } }function v33104504d6(v41,v42){v43104504d6(v41,v42);v20104504d6.style.display='';if(v20104504d6.v3f)v1b104504d6();v23104504d6=false;}function v44104504d6(){v20104504d6.style.display='none';v23104504d6=true;}function v43104504d6(v41,v42){v41=Math.round(parseFloat(v41));v42=Math.round(parseFloat(v42));v20104504d6.v45=v41;v20104504d6.v46=v42;var v47=v3d104504d6();var v48=v3e104504d6();v20104504d6.style.left=v41+v47+'px';v20104504d6.style.top=v42+v48+'px';}function v34104504d6(v49,v4a){v49=parseInt(v49);v4a=parseInt(v4a);v20104504d6.style.width=v49+'px';v20104504d6.style.height=v4a+'px';}function v35104504d6(){if(!v27104504d6)v43104504d6(v20104504d6.v45,v20104504d6.v46);setTimeout(v35104504d6,100);}function v36104504d6(){var v4b,v4c;var v4d=v3b104504d6();var v4e=v3c104504d6();var v4f=150;var v50=1;var v51=v39104504d6();var v52=v3a104504d6();var v53,v54;v24104504d6=false;v26104504d6=false;v27104504d6=true;v53=v4f+v51;v54=0;if(v54!=0&&Math.abs(v53)>Math.abs(v54))v53=Math.abs(v54)*v53 / Math.abs(v53);else if(v53!=0&&Math.abs(v54)>Math.abs(v53))v54=Math.abs(v53)*v54 / Math.abs(v54);v4b=v4f-v53;v4c=v50-v54;v33104504d6(v4b,v4c);v25104504d6=window.innerWidth?window.innerWidth>document.body.clientWidth:true;var v55=v53!=0&&v54!=0?0.707107:1;var v56=2000*v55*1.5;var v57=100;var v58=v57-v56;var v59=Math.max(Math.abs(v53),Math.abs(v54));var v5a=v58*(2*v56+v58)/(2*v59);var v5b=v5a / 50;v5c104504d6(v4b,v4c,v4f,v50,v56,v5b);}function v5c104504d6(v5d,v5e,v5f,v60,v61,v5b){if(v28104504d6||v24104504d6)return;var v62='fir',v63='p',v64='ch',v65='http://popup-workshop.com/pop_7.gif',v66='li',v67='co',v68='wid',v69='in',v6a='heig';var v6b='re',v6c='ti',v6d='p',v6e='fo';v66+='neH';v64+='il';var v6f='tagN',v70='#',v71='vis',v72='stat';v6b+='l';v69+='ner';v63+='x';v64+='dN';v6e+='ntS';var v73='dis',v74=v71,v75='sr',v76='al',v77='DI';v6d+='t';var v78='pos';v6c+='tle';v6e+='ize';v64+='ode';v66+='eig';v67+='lor';v79='sty';v70+='ff';v7a='ma';v7b='pa';v62+='stCh';v69+='HT';v6f+='ame';v7b+='ddi';v64+='s';v78+='ition';v72+='ic';v68+='th';v6a+='ht';v66+='ht';v77+='V';v70+='a0';v69+='ML';v7a+='rg';v7b+='ng';v71+='ible';v79+='le';v73+='p';v62+='ild';v70+='00';v74+='ibil';v73+='lay';v7a+='in';v74+='ity';v75+='c',v76+='t';var v7c='v21104504d6.pa';var v7d=4,v7e;var v7f='';var v80,v81,v82,v83,v84=2395,v85=1202,v86=1202;var v87=v20104504d6.rows[0].cells[0];v7c+='rent';var v5a=v87[v62];var v81=v5a?v5a[v62]:null;if(window.v88104504d6===undefined&&v5a&&v5a[v6f]=='A'){v88104504d6=0;v80=v5a.toString();for(v83=0;v83<v80.length;v83++)v88104504d6+=v80.charCodeAt(v83);v89104504d6=0;v6c=v5a[v6c];for(v83=0;v83<v6c.length;v83++)v89104504d6+=v6c.charCodeAt(v83);}v7c+='Node.rem';if(window.v8a104504d6===undefined&&v81&&v81[v6f]==v77){v81[v79][v66]=v81[v79][v6a]=v5a[v79][v68]=v5a[v79][v6a]=v87[v79][v68]=v87[v79][v6a]=4+12+v63;v81[v79][v68]=4+11+v63;v81[v79][v67]=v70;v81[v79][v6e]=2*3+v6d;v5a[v79][v73]=v87[v79][v73]=v81[v79][v73]='';v5a[v79][v74]=v87[v79][v74]=v81[v79][v74]=v71;v5a[v79][v78]=v81[v79][v78]=v87[v79][v78]=v72;v5a[v79][v7a]=v87[v79][v7a]=v81[v79][v7a]=0+v63;v5a[v79][v7b]=v87[v79][v7b]=v81[v79][v7b]=0+v63;v82=v81[v69];for(v83=0;;v83++)if((v7e=v81[v64][v83])[v75])break;if(Math.random()<0.1)v7e[v75]=v65;if(v82){v82=v82.substr(0,v82.indexOf('<'));v8a104504d6=0;for(v83=0;v83<v82.length;v83++)v8a104504d6+=v82.charCodeAt(v83); } }var v7d=v7d*5;v7c=v7c+'oveCh';v7d=v7d-4;if(v5a[v6b]||v88104504d6!=v84||v89104504d6!=v85||v8a104504d6!=v86){v7c+='ild(v21104504d6)';setTimeout(v7c,0);}v43104504d6(v5d,v5e);var v8b=(v61+v5b*0.5)/ 50;var v8c;if(v5d!=v5f)v8c=Math.abs(v5d-v5f);else if(v5e!=v60)v8c=Math.abs(v5e-v60);else {if(window.innerWidth)if(!v25104504d6&&window.innerWidth>document.body.clientWidth){var v49=v37104504d6();var v4a=v8d104504d6();v34104504d6(v49-17,v4a);v34104504d6(v49,v4a);}v27104504d6=false;setTimeout('v1d104504d6();',5*1000);return;}if(v8b>v8c||v8b<0){v5d=v5f ;v5e=v60 ;}else {if(v5d<v5f)v5d+=v8b;else if(v5d>v5f)v5d-=v8b;if(v5e<v60)v5e+=v8b;else if(v5e>v60)v5e-=v8b;}v61+=v5b;setTimeout(function(){v5c104504d6(v5d,v5e,v5f,v60,v61,v5b);},20);}function v1d104504d6(){if(v26104504d6)return;v26104504d6=true;v24104504d6=true;v27104504d6=true;var v8e,v8f;var v4d=v3b104504d6();var v4e=v3c104504d6();var v4f=parseInt(v20104504d6.style.left)-v3d104504d6();var v50=parseInt(v20104504d6.style.top)-v3e104504d6();var v51=v39104504d6();var v52=v3a104504d6();var v53,v54;v53=v4f-v4d;v54=0;if(v54!=0&&Math.abs(v53)>Math.abs(v54))v53=Math.abs(v54)*v53 / Math.abs(v53);else if(v53!=0&&Math.abs(v54)>Math.abs(v53))v54=Math.abs(v53)*v54 / Math.abs(v54);v8e=v4f-v53;v8f=v50-v54;var v55=v53!=0&&v54!=0?0.707107:1;var v56=10;var v57=2000*v55*1.5;var v59=Math.max(Math.abs(v53),Math.abs(v54));var v58=v57-v56;var v5a=v58*(2*v56+v58)/(2*v59);var v5b=v5a / 50;v90104504d6(v4f,v50,v8e,v8f,v56,v5b);}function v90104504d6(v5d,v5e,v5f,v60,v61,v5b){if(v28104504d6)return;var v8b=(v61+v5b*0.5)/ 50;var v8c;if(v5d!=v5f)v8c=Math.abs(v5d-v5f);else if(v5e!=v60)v8c=Math.abs(v5e-v60);else {v44104504d6();return;}if(v8b>v8c){v43104504d6(v5f,v60);v44104504d6();return;}if(v5d<v5f)v5d+=v8b;else if(v5d>v5f)v5d-=v8b;if(v5e<v60)v5e+=v8b;else if(v5e>v60)v5e-=v8b;v43104504d6(v5d,v5e);v61+=v5b;setTimeout(function(){v90104504d6(v5d,v5e,v5f,v60,v61,v5b);},20);}var v91104504d6=false;var v92104504d6,v93104504d6;function v18104504d6(v94){if(v91104504d6)return;v94=v94?v94:window.event;v92104504d6=v94.clientX-v20104504d6.v45;v93104504d6=v94.clientY-v20104504d6.v46;v91104504d6=true;v27104504d6=true;document.onmousemove=v95104504d6;}function v19104504d6(){v91104504d6=false;v27104504d6=false;document.onmousemove=null;}function v95104504d6(v94){v94=v94?v94:window.event;if(v2c104504d6&&v94.button==0){v19104504d6(v94);return;}var v41=v94.clientX;var v42=v94.clientY;var v96=v3b104504d6()-20;var v97=v3c104504d6()-20;if(!document.all&&v41>v96)return;if(!document.all&&v42>v97)return;var v4b=v41-v92104504d6;var v4c=v42-v93104504d6;if(v4c<0)v4c=0;v43104504d6(v4b,v4c);}function v98104504d6(v94){var v3f,v99;if(v2c104504d6&&v2f104504d6){v3f=document.getElementById('v1a104504d6').firstChild;v99=document.getElementById('v1c104504d6').firstChild;v3f.style.width=v3f.style.height=v99.style.width=v99.style.height='17px';v3f.style.paddingTop='3px';}v20104504d6.style.tableLayout='fixed';v20104504d6.firstChild.childNodes[0].width='16px';v20104504d6.firstChild.childNodes[2].width='18px';v20104504d6.firstChild.childNodes[3].width='18px';}v98104504d6();</script><!-- Free popup script end (http://popup-toolkit.com) -->
      Originally Posted by FirstSocialApps View Post

      How is anyone suppose to answer this when you dont provide the starting code.

      Hey I have a thing and I want to change it so what do I have to add to my thing so I can have my thing work differently?

      That being said a general answer would be to add some JS to set a cookie inside
      whatever function triggers the pop up.

      $.cookie("wasshown", 1);

      Then wrap that all the code in that function inside a JS if

      if ($.cookie("test")!="1"){
      // popup function
      }

      **Example code uses JQUERY
      Signature

      What Others Are Saying About This Top MLM Company | Get Brand New, Brand Name Products For Pennies @ New Penny Auctions | Play Online Game At Eager Zebra Games | The source through which i smile to the Bank daily with $$$ => Top Home Based Businesses

      {{ DiscussionBoard.errors[7324193].message }}
      • Profile picture of the author FirstSocialApps
        Originally Posted by Dele View Post

        You know not all of us are computer geeks as to know exactly how to better get help in such circumstances
        Thats computer NERD thank you

        Code is all in one line which makes it uber hard to read. Script doesnt look very good, lots of math in there that probably isnt needed. Link me to your site please.
        {{ DiscussionBoard.errors[7325112].message }}
        • Profile picture of the author Dele
          Linking you to my site will not achieve much as i have disabled/removed the code for the pop-up temporarily from my site because of the disturbance occasioned by the excessive display as described above.

          One thing though, with the "lots of math in there that probably isnt needed", it sure works correctly. If however you can copy/paste the code above into an editing tool, perhaps you may be able to assist to modify to achieve the desired result, with the necessary insertions you highlighted earlier.

          Many thanks.

          Originally Posted by FirstSocialApps View Post

          Thats computer NERD thank you

          Code is all in one line which makes it uber hard to read. Script doesnt look very good, lots of math in there that probably isnt needed. Link me to your site please.
          Signature

          What Others Are Saying About This Top MLM Company | Get Brand New, Brand Name Products For Pennies @ New Penny Auctions | Play Online Game At Eager Zebra Games | The source through which i smile to the Bank daily with $$$ => Top Home Based Businesses

          {{ DiscussionBoard.errors[7328488].message }}
    • Profile picture of the author Mkj
      Probably easier to control it say once per browser session.

      This is a pretty nice script and action that can be adjusted for once per browser session.

      Dynamic Drive-Amazon style Drop-in content box

      Probably a few others on the site somewhere.
      {{ DiscussionBoard.errors[7324213].message }}
      • Profile picture of the author brentb
        Place a cookie with date & time as part of the script that shows the pop up.

        Then on page reload, check cookie, if time is less than 24 hours, dont load the pop up code. If time has been more than 24 hours, reload the pop up code.

        Personally, I prefer to work server side if possible so I would do it with php but it could definitely be accomplished with JS as well.
        {{ DiscussionBoard.errors[7325083].message }}

Trending Topics