Javascript 广告交付刷新率
我在我的网站上有一个网页,人们在那里观看直播流。。。我正试图每十分钟通过OpenX更新那里的广告横幅Javascript 广告交付刷新率,javascript,html,Javascript,Html,我在我的网站上有一个网页,人们在那里观看直播流。。。我正试图每十分钟通过OpenX更新那里的广告横幅 $('#ad_tag_top_left').html($('#ad_tag_top_left').html()); 这不是工作。。。我想知道以前有没有人这样做过,或者有什么建议。我已经验证了$('#ad_tag_top_left').html()确实返回以下代码 <!--//<![CDATA[ document.MAX_ct0 ='INSERT_CLICKURL_HERE';
$('#ad_tag_top_left').html($('#ad_tag_top_left').html());
这不是工作。。。我想知道以前有没有人这样做过,或者有什么建议。我已经验证了$('#ad_tag_top_left').html()
确实返回以下代码
<!--//<![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 ('&cb=' + m3_r);
if (document.MAX_used != ',')
document.write ("&exclude=" + document.MAX_used);
document.write (document.charset ? '&charset='+document.charset : (document.characterSet ? '&charset='+document.characterSet : ''));
document.write ("&loc=" + escape(window.location));
if (document.referrer)
document.write ("&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 ("&ct0=" + escape(document.MAX_ct0));
}
if (document.mmm_fo)
document.write ("&mmm_fo=1");
document.write ("'><\/scr"+"ipt>");
//]]>-->
即使在HTML注释标记中,注释也会阻止它执行吗?(在上面的代码段和它引用的广告代码中都使用)将仅在页面加载时工作,因此您的代码(无论如何都不能用于执行JavaScript)无法工作。在您的情况下,最好的解决方案(即,如果您无法重写脚本以完全使用jQuery)是将广告代码放在iframe中:
<iframe
src="ad_code.html"
width="width of your banner"
height="height of your banner"
frameBorder="0"></iframe>
希望广告代码(如果点击广告)不会在iframe中而是在包含窗口中打开赞助商的网页。OpenX提供iframe调用代码,并支持本机刷新
<script>
setTimeout(function() {
window.location.reload();
}, 600000);
</script>