1
<div name="googleAd">
 <script type="text/javascript">
            google_ad_client = "ca-pub-xxxxxxxxxxxxx";
            <!--/* BottomRight */-->
            google_ad_slot = "1781127922";
            google_ad_width = 180;
            google_ad_height = 150;
          </script>

          <script name="test" type="text/javascript"
                 src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
          </script>
</div>

I'm going to add Google AdSense to my page and I want to refresh it to view other ads. How can I achieve this one? I'm using XSLT. Thanks for the help.

0xCursor
  • 2,242
  • 4
  • 15
  • 33
iCeR
  • 139
  • 3
  • 15
  • Duplicate of http://stackoverflow.com/questions/4260018/google-adsense-reloading and http://stackoverflow.com/questions/435391/refresh-a-div-that-has-a-google-ad-inside-it/435432#435432 –  Feb 04 '13 at 03:28

2 Answers2

4

If the webpage is using jQuery, just implement the code bellow:

$(".adsbygoogle").each(function(i,e){$(e).html($(e).html())});

And, if you want to refresh it each 60 seconds, there is a sample you can try:

var ad_refresher = setInterval(function(){
        $(".adsbygoogle").each(function(i,e){
            $(e).html($(e).html())
        });
    }, 60000);

If the code above was implemented, stop the refresh behaviour with:

clearInterval(ad_refresher);

I suggest you to check Google Adsense documentation if you are allowed to refresh the ads.

Pepelegal
  • 81
  • 1
  • 3
2

If you examine the DOM of page with Adsense ads on it, you'll see an iframe. You can find the iframe and then reload it with

iframe.contentWindow.location.reload();

You may have to tweak things to get this to work exactly right.

  • Is ads reloading is allowed in Adsense ?? also reloading mean more impression or not ??? i have seen one popular site doing that reloading on adsense – user889030 Aug 18 '22 at 11:10