<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>
我要将 Google AdSense 添加到我的页面,我想刷新它以查看其他广告。我怎样才能实现这一目标?我正在使用 XSLT。谢谢您的帮助。
最佳答案
如果网页使用的是 jQuery,只需执行以下代码:
$(".adsbygoogle").each(function(i,e){$(e).html($(e).html())});
而且,如果您想每 60 秒刷新一次,可以尝试一个示例:
var ad_refresher = setInterval(function(){
$(".adsbygoogle").each(function(i,e){
$(e).html($(e).html())
});
}, 60000);
如果实现了上面的代码,停止刷新行为:
clearInterval(ad_refresher);
如果允许刷新广告,我建议您查看 Google Adsense 文档。
关于javascript - 如何刷新 Google AdSense 内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14643840/