Fixed JavaScript ads in notices not working


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

<script type='text/javascript'><!--//<![CDATA[
  var m3_u = (location.protocol=='https:'?'':'');
  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=';cb=INSERT_RANDOM_NUMBER_HERE' target='_blank'><img src=';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.


XenForo developer
Staff member
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.


Well-known member
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.


XenForo developer
Staff member
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.