如何刷新 Google AdSense 内容
How to refresh Google AdSense content?
<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文档,如果允许您刷新广告。
如果您检查带有 Adsense 广告的网页的 DOM,您会看到一个 iframe。您可以找到 iframe,然后重新加载它
iframe.contentWindow.location.reload();
您可能需要调整内容才能使其完全正确。
相关文章:
- 如何在Google柱状图中动态添加行/列
- Google/html5语音识别JavaScript SDK Chrome网络工具包SpeechRecognition
- 使用Google Visualization动态调用构造函数
- Firebase2(Firebase.google.com)推送通知-从外部管理
- 是否可以控制获取哪些Google地图脚本(JavaScript API)
- Google Adsense多次加载脚本
- Google AdSense:将背景颜色更改为透明
- URL中用户@的几个请求导致“;违反政策通知;来自Google AdSense
- 如何禁用基于布尔值的Google AdSense脚本
- Orbit Slider jQuery and Google Adsense
- Google AdSense 代码未在 asp.net 中执行
- 当登录是使用 JSON 时,如何让 Google Adsense 访问登录区域中的页面
- 内容安全策略可以与Google Analytics和AdSense兼容吗
- 如何使用preg_match自动将常规Google AdSense广告转换为响应广告
- cakePHP and Google AdSense
- 学习和理解Google AdSense在幕后是如何工作的
- Google Adsense在页面上破坏JavaScript:不安全的JavaScript试图访问带有URL的框架
- 仅向搜索引擎访问者显示Google AdSense广告
- 使用html javascript向搜索引擎流量显示Google AdSense广告
- 如何刷新 Google AdSense 内容