How to make Google Adsense load last after the res

2019-04-08 06:24发布

问题:

I have a page with Google Adsense ads. Content is to the left and ads are to the right. When the page is downloading it retrieves the content first and then start with the Google Adsense ads. During that time the rest of the page (footer images) is not fetched until the whole ad is completely downloaded.

How can I make all of my page (content, images) load first and the ad load last?

回答1:

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.



回答2:

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



回答3:

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.



回答4:

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

http://semplicewebsites.com/google-ads



回答5:

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.