How to make Google Adsense load last after the rest of page

蹲街弑〆低调 提交于 2019-12-04 06:21:30

You'll have to put the ad code at the bottom of your html (php, asp, whatever) page so that the browser requests that data last. Browsers read from the top of the document to the end of the document and request along the way. I don't think there's any way around that.

You can still place the ad near the top of the page using css. An absolute position, or some crazy floats might be able to do it.

There is no need to do this now. AdSense announced that ad requests will not be blocking page content anymore: http://adsense.blogspot.com/2011/03/making-web-faster-for-all-adsense-for.html

I think the simplest way would be to use body onload to start a javascript timer which after say 5 seconds will then populate the html of a div placeholder.

If you want to wait for everything to load you will need to keep track of every image, etc in an array.

Yep, this is the way to go. I've discussed it in more detail here, with examples:

http://semplicewebsites.com/google-ads

The lnk in the other answer:

http://semplicewebsites.com/google-ads

...is definitely the way to go. I had a few issues to do it with jQuery, but this is what I used. I bascially just move the iframe, after a bit of CSS tweaking.

Assume you load the ads at the bottom of the page in a (hidden) div called ads_footer, and you want them to go in a div called ads_inline (as in the example in the link). You can do this:

$(document.ready(
  function() {
    $('#ads_footer iframe').css('position', '')
    $('#ads_inline').append($('#ads_footer iframe'))
  })

No need for any floats or fancy CSS, apart from removing the absolute positioning.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!