首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >广告投递刷新率

广告投递刷新率
EN

Stack Overflow用户
提问于 2010-11-23 10:58:04
回答 2查看 1.3K关注 0票数 2

我在我的网站上有一个页面,人们在那里观看直播流..。我正在尝试每十分钟通过OpenX更新一次那里的广告横幅。

代码语言:javascript
复制
$('#ad_tag_top_left').html($('#ad_tag_top_left').html());

这不是工作..。我想知道以前有没有人这样做过,或者有什么建议。我已经验证了$('#ad_tag_top_left').html()确实返回了以下代码...

代码语言:javascript
复制
<!--//<![CDATA[
  document.MAX_ct0 ='INSERT_CLICKURL_HERE';

  var m3_u = (location.protocol=='https:'?'https://www.gamer-source.com/ad-server/www/delivery/ajs.php':'http://www.gamer-source.com/ad-server/www/delivery/ajs.php');
  var m3_r = Math.floor(Math.random()*99999999999);

  if (!document.MAX_used)
    document.MAX_used = ',';

  document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
  document.write ("?zoneid=62");
  document.write ('&amp;cb=' + m3_r);

  if (document.MAX_used != ',')
    document.write ("&amp;exclude=" + document.MAX_used);

  document.write (document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));
  document.write ("&amp;loc=" + escape(window.location));

  if (document.referrer)
    document.write ("&amp;referer=" + escape(document.referrer));

  if (document.context)
    document.write ("&context=" + escape(document.context));

  if ((typeof(document.MAX_ct0) != 'undefined') && (document.MAX_ct0.substring(0,4) == 'http')) {
    document.write ("&amp;ct0=" + escape(document.MAX_ct0));
  }

  if (document.mmm_fo) 
    document.write ("&amp;mmm_fo=1");

  document.write ("'><\/scr"+"ipt>");
//]]>-->

即使它在HTML注释标记中,注释会阻止它执行吗?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2010-11-23 11:15:20

document.write (在上面的代码片段和它引用的广告代码中使用)只能在页面加载时工作,所以你的代码(无论如何都不能用来执行JavaScript )不能工作。在您的情况下,最好的解决方案(即,如果您不能重写脚本以完全使用jQuery )是将广告代码放入iframe:

代码语言:javascript
复制
<iframe
    src="ad_code.html"
    width="width of your banner"
    height="height of your banner"
    frameBorder="0"></iframe>

然后,除了广告代码之外,还将此自动刷新代码放入ad_code.html文件:

代码语言:javascript
复制
<script>
setTimeout(function() {
    window.location.reload();
}, 600000);
</script>

希望广告代码(如果广告被点击)不是在iframe中打开赞助商的网页,而是在包含窗口中打开。

票数 0
EN

Stack Overflow用户

发布于 2011-10-11 18:17:17

OpenX提供了iFrame调用代码,并支持本机刷新。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4252355

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档