对于第 3 方 Open X Server,如果他们的站点出现故障,我们如何阻止它尝试加载?
下面的代码是正在投放的广告。由于广告位于页面的最顶部,因此我们希望确保即使服务器发生故障,它也不会阻止网站加载。我们正在寻找 JavaScript 或 C# ASP.NET 解决方案。我们尝试重写它以在 DOM Ready 上工作,但它似乎并不那样工作。
<!--LEADERBOARD AD-->
<center>
<div>
<script type='text/javascript'><!-- //<![CDATA[
var m3_u = (location.protocol == 'https:' ? 'https://www.oncampusweb.com/delivery/ajs.php' : 'http://www.oncampusweb.com/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=341");
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 (document.mmm_fo) document.write("&mmm_fo=1");
document.write("'><\/scr" + "ipt>");
//]]>--></script><noscript><a href='http://www.oncampusweb.com/delivery/ck.php?n=ae7029e9&cb=INSERT_RANDOM_NUMBER_HERE' target='_blank'><img src='http://www.oncampusweb.com/delivery/avw.php?zoneid=341&cb=INSERT_RANDOM_NUMBER_HERE&n=ae7029e9' border='0' alt='' /></a></noscript>
</div>
</center>
<!--LEADERBOARD AD-->
The code below is the ad that is being served. Since the ad is at the very top of the page, we want to make sure that it doesn't stop the site from loading if their server happens to go down. We are looking for either a javascript or C# ASP.NET solution. We have tried rewriting it to work on DOM Ready, but it does not seem to work that way.
<!--LEADERBOARD AD-->
<center>
<div>
<script type='text/javascript'><!-- //<![CDATA[
var m3_u = (location.protocol == 'https:' ? 'https://www.oncampusweb.com/delivery/ajs.php' : 'http://www.oncampusweb.com/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=341");
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 (document.mmm_fo) document.write("&mmm_fo=1");
document.write("'><\/scr" + "ipt>");
//]]>--></script><noscript><a href='http://www.oncampusweb.com/delivery/ck.php?n=ae7029e9&cb=INSERT_RANDOM_NUMBER_HERE' target='_blank'><img src='http://www.oncampusweb.com/delivery/avw.php?zoneid=341&cb=INSERT_RANDOM_NUMBER_HERE&n=ae7029e9' border='0' alt='' /></a></noscript>
</div>
</center>
<!--LEADERBOARD AD-->
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我依稀记得几年前也遇到过类似的问题。我所要做的就是将广告加载到页脚中。这样,您的页面将始终加载。当然,缺点是页面完全加载后才会显示。
I vaguely remember facing a similar problem I had a few years ago. What I had to do was load the ad in the footer. That way, your page will always load. Of course, the downside is that it won't display until the page is fully loaded.
只需在我们的 SQL 服务器中创建一个位,如果网站加载失败,可以翻转该位。这将阻止网站尝试加载广告。
Simply just created a bit in our SQL server that could be flipped if the site was failing to load. This would stop the site from trying to load the ad at all.