Loading Nuffnang Ads Asynchronously

July 19, 2011 Neil

————–WARNING————–
In just an hour after implementing this technique, Nuffnang has booted me off Gliteratti. After I stopped using this method, it took 4 days for my Gliteratti membership to be re-activated.

————–WARNING————–

Nuffnang Ads are really really really slow, taking more than 20 seconds to load during peak hours that I decided to remove it from my more serious blog. And what’s worse is that it doesn’t even display a real ad.

A few days ago, I started searching for ways to load the script asynchronously and without modifications on the actual code provided. Today, I found it.

Here it is:

1. Create an html file and put the Nuffnang-provide javascript code in it. (example: nuffnang.html)

2. Upload that file into your server, preferably on the main directory. (example: http://www.kartonista.com/nuffnang.html)

3. On the location where you want the ad to show up, place:

<div id=”AdAuth”></div>

4. Place this piece of code right below the <div> above:

<script type="text/javascript"> 
(function(){
  function loadAds() {
    var c4 = "<iframe frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="200" src="http://www.kartonista.com/nuffnang.html"></iframe>";
	var adauth = document.getElementById('AdAuth'); if(adauth!=null) adauth.innerHTML=c4;
  }
  var oldonload = window.onload;
  window.onload = (typeof window.onload != 'function') ?
     loadAds : function() { oldonload(); loadAds(); };
})();
</script>

*Note: Make sure to replace the src=”” with the location of the Nuffnang html file. Notice that I use (http://www.kartonista.com/nuffnang.html)

That should do the trick. I only maintain one NN ad, so can’t assure you that this will work on multiple ads.

What I’m worried is the height of the iFrame. I’m not sure if the iFrame will automatically increase its height when the real ad shows up or will it hide some parts of the it.

I received an email from Nuffnang after my inquiry regarding this technique.

Hi Neil,
Yup, you can do so as long as the iframe is in the same domain. Thanks! =)

Source:  How to load advertisement asynchronously

10 responses to “Loading Nuffnang Ads Asynchronously”

  1. Aj Banda

    Hi.. nice article.. Using this, you might need to think also that not all browsers use/support iframe (that is one of the rules in web designing).. :p

    Also, also why does nuffnang removed you from gliteratti? just curious..

  2. Aj Banda

    i see.. I guess, one thing to resolve this, since nuffnang don’t usually show ads regularly, is to place the add at the bottom of the page. This way the article would be loaded first before the ad.

  3. Jadestone

    this is very informative for i am planning to place a NN ad on my site.

  4. Georgetta

    You could pick from any one of our online and also available Psychics whenever and have
    the possibility to connect either for Phone Readings or by Live Psychic Chat.

  5. płot PCV na ogrodzenie i bramę ze sztachet, sztachety z plastiku, Nowoczesne ogrodzenie, ogrodzenia Winylowe Wrocław i w pobliżu, ogrodzenia PCV na ogrodzenie i bramkę ze sztachet, ogrodzenia plastykowe ogrodowe

    Front-yard fences really should not be the similar variety of privacy
    fence as in a backyard they should be much more open and friendlier,
    setting off your gardsn rather than sealing it off.

  6. Felicitas

    Flippantly rub every pearl with the cloth, and allow
    them to air-dry.

  7. princesscarlie1988.tumblr.com

    A compressor consists of two components: the power source and the compressing mechanism (piston, vane, etc.

    Plus as the air drives the nails straight in it does so without damaging the surrounding area.
    Learn more about where a ship gets its compressed air supply from.

  8. Freedom apk

    I have to thank you for the efforts you have put in penning this blog.

    I’m hoping to view the same high-grade content from you
    later on as well. In fact, your creative writing
    abilities has motivated me to get my very own website now ;)

  9. zapatos niña

    Nice post. I used to be checking continuously this weblog and I am inspired!
    Extremely useful info specially the final phase :) I care for such info much.
    I was seeking this particular information for a very
    lengthy time. Thanks and good luck.

Leave a Reply