• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Fixed JavaScript ads in notices not working

dutchbb

Well-known member
#1
I tried adding this JavaScript in a notice:

HTML:
<script type='text/javascript'><!--//<![CDATA[
  var m3_u = (location.protocol=='https:'?'https://www.dutchbodybuilding.com/adserver/www/delivery/ajs.php':'http://www.dutchbodybuilding.com/adserver/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=15&amp;target=_blank&amp;charset=Windows-1252");
  document.write ('&amp;cb=' + m3_r);
  if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used);
  document.write ('&amp;charset=Windows-1252');
  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 (document.mmm_fo) document.write ("&amp;mmm_fo=1");
  document.write ("'><\/scr"+"ipt>");
//]]>--></script><noscript><a href='http://www.dutchbodybuilding.com/adserver/www/delivery/ck.php?n=afea1d05&amp;cb=INSERT_RANDOM_NUMBER_HERE' target='_blank'><img src='http://www.dutchbodybuilding.com/adserver/www/delivery/avw.php?zoneid=15&amp;charset=Windows-1252&amp;cb=INSERT_RANDOM_NUMBER_HERE&amp;n=afea1d05' border='0' alt='' /></a></noscript>
The forum then loads only the banner ads on the screen.
 

Kier

XenForo Developer
Staff member
#2
I need to investigate this further, but my suspicion is that we are using element cloning to make the notices scroller system work, so this code, which uses document.write(), may simply never work with the notices system at all.
 

Marcus

Well-known member
#4
Yes for integrating my doubleclick tags I now know the document write is executed when the surrounding function is true (or without a function is always executed). You also can not clone them by $jquery.append, in this case the banner is displayed twice. You only have two option:

- manipulate css
- work with conditionals around the scripts to whether execute them or not

Doing these things to adsense can also result in closing your adsense account.

Your tag looks like openx or is at least similar to it. There might be a solution without document.write to display banners to your page.
 

Mike

XenForo developer
Staff member
#6
It looks like if I just strip script tags from the notices before the cloning happens, everything is ok. That shouldn't be a problem as any inline script tags would've run by then anyway.