SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Addict Scud's Avatar
    Join Date
    Jan 2002
    Location
    Los Angeles
    Posts
    222
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Geocities Pop-Under, how?

    Geocities has a pop-under ad that seems to load under the main window. I can't seem to duplicate this, mine always draws on top, then fades focus and moves to the background creating a "flash."

    Anyone know how or why Geocities' doesn't do this? Or how I can get it to draw the new pop-up in the rear?

  2. #2
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's their code. I can't be bothered to root through it! You can...

    Code:
    var PUisIE_NAV4 = false;
    if (parseFloat(navigator.appVersion) >= 4) {
    	PUisIE_NAV4 = true;
    }
    
    var PUwinWidth='740';
    var PUwinHeight='300';
    
    var PUtimes = 1;  /* number of times to show ad.  if > times, then redirect thru */
    var PUtheDomain = ".geocities.com";
    var PUexpiresIn = 4/24; /* days between shows of the ad */
    
    function PUsetCook(t,expIn) {
    	var cook;
    	var PUexDate;
    	PUexDate = new Date;
    	PUexDate.setTime(PUexDate.getTime() + expIn*24*60*60*1000);
    	cook = "PU=t="+t+"; expires=" + PUexDate.toGMTString() +"; domain="+PUtheDomain + "; path=/";
    	document.cookie = cook;
    }
    
    var PU_NO_COOKIES = 2;
    
    function PUgetCook(x) {
    	var i,j,a,b,s,e,d,f;
    	a = document.cookie;
    	//if (a == "") return PU_NO_COOKIES;
    	s = a.indexOf(x + "=");
    	if (s == -1) return false;
    	s += x.length+1;
    	e = a.indexOf(';',s);
    	if (e == -1) e = a.length;
    	return a.substring(s,e);
    }
    
    /* check cookies - if cookies are off or if user saw it X times, then we redirect thru */
    
    var PUd;
    var PUb=PUgetCook("PU");
    var PUoverTimes = 0;
    
    if (PUb == PU_NO_COOKIES) {
    	PUoverTimes = 1;
    } else {
        if (PUb != false) {
            PUb = PUb.split('&');
            for (PUi=0; PUi<PUb.length; PUi++) {
                PUd = PUb[PUi].split('=');
            	if (PUd == "t") {
            	  	last;
            	}
            }
            PUd[1]++;
            if (PUd[1] > PUtimes) {
            	PUoverTimes = 1;
            } else {
            	PUsetCook(PUd[1],PUexpiresIn);
    	}
        } else {
           	PUsetCook(1,PUexpiresIn);
        }
    }
    
    function PUlaunchPU(){
    	var PUwin;
    	var addIt = PUisIE_NAV4 ? ',top=5000,left=5000' : '';
    	PUwin=window.open('about:blank','PUwin', 'width='+PUwinWidth+',height='+PUwinHeight+',location=no,menubar=no,titlebar=no,status=no,toolbar=no,scrollbars=yes,resizable=no'+addIt,true);
    	PUwin.blur();
    	return PUwin;
    }
    
    if (PUoverTimes < 1) {
    	document.write('<script src="http://us.adserver.yahoo.com/a?f='+PUpage+'&p='+PUprop+'&l=PUC&c=o&bg=ffffff" language=javascript></');
    	document.write('script>');
    }

  3. #3
    SitePoint Addict Scud's Avatar
    Join Date
    Jan 2002
    Location
    Los Angeles
    Posts
    222
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    mine is the same as theirs only for some reason mine draws infront of the current window then pushes back (which is always how I thought it should work) but Geocitites eludes me on how they get it to actually load behind.

  4. #4
    SitePoint Wizard silver trophy
    Join Date
    May 2003
    Posts
    1,843
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    var PUisIE_NAV4 = false; if (parseFloat(navigator.appVersion) >= 4) { PUisIE_NAV4 = true; }
    ..............
    var addIt = PUisIE_NAV4 ? ',top=5000,left=5000' : '';
    PUwin=window.open('about:blank','PUwin', 'width=...........resizable=no'+ addIt,true);
    That extra bit opens the pop-up off-screen (not all browsers support this, but IE does).
    ::: certified wild guess :::

  5. #5
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ahhhhh... now that's clever. There's your answer!

  6. #6
    SitePoint Addict Scud's Avatar
    Join Date
    Jan 2002
    Location
    Los Angeles
    Posts
    222
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I suggested that to the developers working on this project but they ignored me and said, "find out how they do it!" ... I love those rare times I get to say "I told you so."


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •