The Most Active and Friendliest
Affiliate Marketing Community Online!

“Propeller”/  Direct Affiliate

Free Tumblr/Website Popunder script

seangugerty

Member
I had a bit of a time when I was beginning obtaining a quick and efficient popunder script that penetrates Chrome browsers block every time. But thankfully my affiliate hooked me up. I hope this helps some of you out! May the conversions be with you!


The code you can store anywhere on your site or offsite but you'll need to link to it either in your header or footer with:
<script src="[link goes here]" type="text/javascript"></script>
Here is the popunder script:
Code:
// jsPopUnda - 2014
// Lan @ TitsPlz.com

function jsUnda(sUrl, sConfig) {

   var _parent  = (top != self && typeof(top.document.location.toString()) === 'string') ? top : self;
   var unda = null;

   sConfig      = (sConfig || {});

   var sName    = (sConfig.name   || Math.floor((Math.random() * 1000) + 1));
   var sWidth   = (sConfig.width  || window.outerWidth  || window.innerWidth);
   var sHeight  = (sConfig.height || (window.outerHeight-100) || window.innerHeight);

   var sPosX    = (typeof(sConfig.left) != 'undefined') ? sConfig.left.toString() : window.screenX;
   var sPosY    = (typeof(sConfig.top)  != 'undefined') ? sConfig.top.toString()  : window.screenY;

   /* capping */
   var sWait    = (sConfig.wait || 3600); sWait = (sWait * 1000);
   var sCap     = (sConfig.cap  || 2);

   /* cookie stuff */
   var popsToday = 0;
   var cookie    = (sConfig.cookie || '__.unda');

   var browser = function() {
       var n = navigator.userAgent.toLowerCase();
       var b = {
           webkit: /webkit/.test(n),
           mozilla: (/mozilla/.test(n)) && (!/(compatible|webkit)/.test(n)),
           chrome: /chrome/.test(n),
           msie: (/msie/.test(n)) && (!/opera/.test(n)),
           firefox: /firefox/.test(n),
           safari: (/safari/.test(n) && !(/chrome/.test(n))),
           opera: /opera/.test(n)
       };
       b.version = (b.safari) ? (n.match(/.+(?:ri)[\/: ]([\d.]+)/) || [])[1] : (n.match(/.+(?:ox|me|ra|ie)[\/: ]([\d.]+)/) || [])[1];
       return b;
   }();


   function isCapped() {
       try {
           popsToday = Math.floor(document.cookie.split(cookie + 'Cap=')[1].split(';')[0]);
       } catch (err) {}
       return (sCap <= popsToday || document.cookie.indexOf(cookie + '=') !== -1);
   }


   function doUnda(sUrl, sName, sWidth, sHeight, sPosX, sPosY) {
       if (isCapped()) return;

       var sOptions = 'toolbar=no,scrollbars=yes,location=yes,statusbar=yes,menubar=no,resizable=1,width=' + sWidth.toString() + ',height=' + sHeight.toString() + ',screenX=' + sPosX + ',screenY=' + sPosY;

       document.onclick = function() {
           if (isCapped()) return;
         
           // ---
           // chrome27 fix
           window.open("javascript:window.focus();", "_self", "");
           // ---

           unda = _parent.window.open(sUrl, sName, sOptions);
           if (unda) {
               // cookie
               var now = new Date();
               document.cookie = cookie + '=1;expires=' + new Date(now.setTime(now.getTime() + sWait)).toGMTString() + ';path=/';
               now = new Date();
               document.cookie = cookie + 'Cap=' + (popsToday + 1) + ';expires=' + new Date(now.setTime(now.getTime() + (84600 * 1000))).toGMTString() + ';path=/';
               pop2under();
           }
       };
   }


   function pop2under() {
       try {
           unda.blur();
           unda.opener.window.focus();
           window.self.window.blur();
           window.focus();

           if (browser.firefox) openCloseWindow();
           if (browser.webkit) openCloseTab();
       } catch (e) {}
   }

   function openCloseWindow() {
       var ghost = window.open('about:blank');
       ghost.focus();
       ghost.close();
   }

   function openCloseTab() {
       var ghost = document.createElement("a");
       ghost.href   = "about:blank";
       ghost.target = "PopHelper";
       document.getElementsByTagName("body")[0].appendChild(ghost);
       ghost.parentNode.removeChild(ghost);

       var clk = document.createEvent("MouseEvents");
       clk.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, true, false, false, true, 0, null);
       ghost.dispatchEvent(clk);

       // open a new tab for the link to target
       window.open(ghost.href, ghost.target).close();
   }


   // abort?
   if (isCapped()) {
       return;
   } else {
       doUnda(sUrl, sName, sWidth, sHeight, sPosX, sPosY);
   }
}

Once you've got the code linked to the webpage you simply add this to your footer with your 4 links:

Code:
URLlist = [
[“http://Site1.com“, 10], // first column is URL, second column is the relative weight
[“http://Site2.com“, 70], // since the total weight is 100, this will happen 70% of the time
[“http://Site3.com“, 10],
[“http://Site4.com“, 10] // last element doesn’t get a comma
];

I hope this helps you guys! :)
 
Last edited:
MI
Back