How to make a pop-under?

Status
Not open for further replies.

WhiteBoi360

Regular Member
Joined
Mar 14, 2012
Messages
243
Reaction score
49
I've googled and tried a few codes/scripts but they don't seem to be working as they are supposed to... I want something like PirateBay's.(pop up blocker doesn't even block theirs) Where the page loads BEHIND the browser or minimized. After all that is what a pop under is, is it not? Well I tried a few different codes and they are popping up like a pop up or putting it in a new tab and switching to it automatically.

I just need to be able to load another landing page in the background that's all.

EDIT: not sure if it matters but I'm using blogger so would need it to work with that. Thanks. Will give rep/thanks.
 
This is the code I've always used in the past.

Change
Code:
http://YOURPOPUNDERPAGE.COM
near the bottom to your target page and place the code in your <head> section.

Code:
<!--Start Popunder-->
<script>
var puShown = false;
var PopWidth = 1370;
var PopHeight = 800;
var PopFocus = 0;
var _Top = null;


function GetWindowHeight() {
var myHeight = 0;
if( typeof( _Top.window.innerHeight ) == 'number' ) {
myHeight = _Top.window.innerHeight;
} else if( _Top.document.documentElement && _Top.document.documentElement.clientHeight ) {
myHeight = _Top.document.documentElement.clientHeight;
} else if( _Top.document.body && _Top.document.body.clientHeight ) {
myHeight = _Top.document.body.clientHeight;
}
return myHeight;
}


function GetWindowWidth() {
var myWidth = 0;
if( typeof( _Top.window.innerWidth ) == 'number' ) {
myWidth = _Top.window.innerWidth;
} else if( _Top.document.documentElement && _Top.document.documentElement.clientWidth ) {
myWidth = _Top.document.documentElement.clientWidth;
} else if( _Top.document.body && _Top.document.body.clientWidth ) {
myWidth = _Top.document.body.clientWidth;
}
return myWidth;
}


function GetWindowTop() {
return (_Top.window.screenTop != undefined) ? _Top.window.screenTop : _Top.window.screenY;
}


function GetWindowLeft() {
return (_Top.window.screenLeft != undefined) ? _Top.window.screenLeft : _Top.window.screenX;
}


function doOpen(url)
{
var popURL = "about:blank"
var popID = "ad_" + Math.floor(89999999*Math.random()+10000000);
var pxLeft = 0;
var pxTop = 0;
pxLeft = (GetWindowLeft() + (GetWindowWidth() / 2) - (PopWidth / 2));
pxTop = (GetWindowTop() + (GetWindowHeight() / 2) - (PopHeight / 2));


if ( puShown == true )
{
return true;
}


var PopWin=_Top.window.open(popURL,popID,'toolbar=0,scrollbars=1,location=1,statusbar=1,menubar=0,resizable=1,top=' + pxTop + ',left=' + pxLeft + ',width=' + PopWidth + ',height=' + PopHeight);


if (PopWin)
{
puShown = true;


if (PopFocus == 0)
{
PopWin.blur();


if (navigator.userAgent.toLowerCase().indexOf("applewebkit") > -1)
{
_Top.window.blur();
_Top.window.focus();
}
}


PopWin.Init = function(e) {


with (e) {


Params = e.Params;
Main = function(){


if (typeof window.mozPaintCount != "undefined") {
var x = window.open("about:blank");
x.close();


}


var popURL = Params.PopURL;


try { opener.window.focus(); }
catch (err) { }


window.location = popURL;
}


Main();
}
};


PopWin.Params = {
PopURL: url
}


PopWin.Init(PopWin);
}


return PopWin;
}


function setCookie(name, value, time)
{
var expires = new Date();


expires.setTime( expires.getTime() + time );


document.cookie = name + '=' + value + '; path=/;' + '; expires=' + expires.toGMTString() ;
}


function getCookie(name) {
var cookies = document.cookie.toString().split('; ');
var cookie, c_name, c_value;


for (var n=0; n<cookies.length; n++) {
cookie  = cookies[n].split('=');
c_name  = cookie[0];
c_value = cookie[1];


if ( c_name == name ) {
return c_value;
}
}


return null;
}


function initPu()
{


_Top = self;


if (top != self)
{
try
{
if (top.document.location.toString())
_Top = top;
}
catch(err) { }
}


if ( document.attachEvent )
{
document.attachEvent( 'onclick', checkTarget );
}
else if ( document.addEventListener )
{
document.addEventListener( 'click', checkTarget, false );
}
}


function checkTarget(e)
{
if ( !getCookie('popundr') ) {
var e = e || window.event;
var win = doOpen('http://YOURPOPUNDERPAGE.COM');


setCookie('popundr', 1, 24*60*60*1000);
}
}


initPu();
</script>
<!--End Popunder-->
 
Try this one

Code:
[SIZE=4]Copy this script and paste it between the <HEAD></HEAD> tags on your Web page:


<script language="JavaScript">
var popunder="http://site-link-goes-here.com/"
function loadpopunder(){
win2=window.open(popunder)
win2.blur()
window.focus()
}
loadpopunder()
</script>[/SIZE]
 
Nope same thing. That one puts it in a new tab and automatically switches to it. Also, firefox popup blocker blocks it. Whatever PirateBay.org uses theirs never gets blocked and loads behind the main browser
 
I think I need an ''OnClick" PopUnder. Anyone know the code for that?
 
That one I posted is onclick but I have no idea why it's opening in the foreground now, never used to.

Hopefully someone with a bit of scripting knowledge can have a quick scan through the code and make it open in a background page for you...
 
That one I posted is onclick but I have no idea why it's opening in the foreground now, never used to.

Hopefully someone with a bit of scripting knowledge can have a quick scan through the code and make it open in a background page for you...

Thanks I think I got it working. However, it only works one time and that is it... not sure if its cookie based or what.. I know nothing on coding.. but is there a way to make it so that every time the user clicks anywhere it opens up instead of just that one time? I tested it and even when you close out of your browser completely and go back to that webpage, the popunder no longer comes back up unless you clear cookies of that website.
 
Yeah, it's cookie based.
You can find what looks to be the cookie settings towards the end of the script, maybe one of those values could stop the cookie being placed.
 
How did you get it popunder onload instead of onclick ?

I didn't. If you do it by click tho the browsers won't block the pop up because it thinks the user intentionally clicked it.
 
This is the code I've always used in the past.

Change
near the bottom to your target page and place the code in your <head> section.

Code:
<!--Start Popunder-->
<script>
var puShown = false;
var PopWidth = 1370;
var PopHeight = 800;
var PopFocus = 0;
var _Top = null;


function GetWindowHeight() {
var myHeight = 0;
if( typeof( _Top.window.innerHeight ) == 'number' ) {
myHeight = _Top.window.innerHeight;
} else if( _Top.document.documentElement && _Top.document.documentElement.clientHeight ) {
myHeight = _Top.document.documentElement.clientHeight;
} else if( _Top.document.body && _Top.document.body.clientHeight ) {
myHeight = _Top.document.body.clientHeight;
}
return myHeight;
}


function GetWindowWidth() {
var myWidth = 0;
if( typeof( _Top.window.innerWidth ) == 'number' ) {
myWidth = _Top.window.innerWidth;
} else if( _Top.document.documentElement && _Top.document.documentElement.clientWidth ) {
myWidth = _Top.document.documentElement.clientWidth;
} else if( _Top.document.body && _Top.document.body.clientWidth ) {
myWidth = _Top.document.body.clientWidth;
}
return myWidth;
}


function GetWindowTop() {
return (_Top.window.screenTop != undefined) ? _Top.window.screenTop : _Top.window.screenY;
}


function GetWindowLeft() {
return (_Top.window.screenLeft != undefined) ? _Top.window.screenLeft : _Top.window.screenX;
}


function doOpen(url)
{
var popURL = "about:blank"
var popID = "ad_" + Math.floor(89999999*Math.random()+10000000);
var pxLeft = 0;
var pxTop = 0;
pxLeft = (GetWindowLeft() + (GetWindowWidth() / 2) - (PopWidth / 2));
pxTop = (GetWindowTop() + (GetWindowHeight() / 2) - (PopHeight / 2));


if ( puShown == true )
{
return true;
}


var PopWin=_Top.window.open(popURL,popID,'toolbar=0,scrollbars=1,location=1,statusbar=1,menubar=0,resizable=1,top=' + pxTop + ',left=' + pxLeft + ',width=' + PopWidth + ',height=' + PopHeight);


if (PopWin)
{
puShown = true;


if (PopFocus == 0)
{
PopWin.blur();


if (navigator.userAgent.toLowerCase().indexOf("applewebkit") > -1)
{
_Top.window.blur();
_Top.window.focus();
}
}


PopWin.Init = function(e) {


with (e) {


Params = e.Params;
Main = function(){


if (typeof window.mozPaintCount != "undefined") {
var x = window.open("about:blank");
x.close();


}


var popURL = Params.PopURL;


try { opener.window.focus(); }
catch (err) { }


window.location = popURL;
}


Main();
}
};


PopWin.Params = {
PopURL: url
}


PopWin.Init(PopWin);
}


return PopWin;
}


function setCookie(name, value, time)
{
var expires = new Date();


expires.setTime( expires.getTime() + time );


document.cookie = name + '=' + value + '; path=/;' + '; expires=' + expires.toGMTString() ;
}


function getCookie(name) {
var cookies = document.cookie.toString().split('; ');
var cookie, c_name, c_value;


for (var n=0; n<cookies.length; n++) {
cookie  = cookies[n].split('=');
c_name  = cookie[0];
c_value = cookie[1];


if ( c_name == name ) {
return c_value;
}
}


return null;
}


function initPu()
{


_Top = self;


if (top != self)
{
try
{
if (top.document.location.toString())
_Top = top;
}
catch(err) { }
}


if ( document.attachEvent )
{
document.attachEvent( 'onclick', checkTarget );
}
else if ( document.addEventListener )
{
document.addEventListener( 'click', checkTarget, false );
}
}


function checkTarget(e)
{
if ( !getCookie('popundr') ) {
var e = e || window.event;
var win = doOpen('');


setCookie('popundr', 1, 24*60*60*1000);
}
}


initPu();
</script>
<!--End Popunder-->

How can make this code auto open popup
 
Use the onbeforeunload even in javascript to call window.open
Keep in mind pop ups/unders no longer work on many browsers these days
 
this unblockable pop under javascript code works with chrome, put it anywhere between the < header> and < /header> tags in your wordpress header
Code:
< script type="text/javascript"  src="http://beaverscripts.com/openwindow.js?puurl=http://www.YOUR-POP-UNDER-ADDRESS.com">< /script>
if there is '?' in your popunder url first shorten it with bit.ly or similar
 
Im wondering this too ringnews24. Were you able to figure it out?
 
Is it possible to post the js script so we can upload it to our servers...


this unblockable pop under javascript code works with chrome, put it anywhere between the < header> and < /header> tags in your wordpress header
Code:
< script type="text/javascript"  src="http://beaverscripts.com/openwindow.js?puurl=http://www.YOUR-POP-UNDER-ADDRESS.com">< /script>
if there is '?' in your popunder url first shorten it with bit.ly or similar
 
just rip it from porn site they always have the latest version.
 
Alternatively, you can create an account on popads and set the minimum cpm very high (like $100) and put the url you want to load in a pop under in the box where it says you should put alternative code in the case where they don't have any ad to serve to your visitors. Ads will never be served because the cpm is too high and the url you put in the box will always load. Hope this solves your problem.
 
Try to use an unblockable code that works well with google chrome. You can insert the code anywhere in the header. Create an account on popads and keep the least cpm high, this will surely help you.
 
Status
Not open for further replies.
Back
Top