1. 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

Discussion in 'Resolved Bug Reports' started by dutchbb, Oct 19, 2011.

  1. dutchbb

    dutchbb Well-Known Member

    I tried adding this JavaScript in a notice:

    <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.
  2. Kier

    Kier 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.
  3. Andy.N

    Andy.N Well-Known Member

    This looks like the code for OpenX banner system.
  4. Marcus

    Marcus 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.
  5. dutchbb

    dutchbb Well-Known Member

    Correct, and it would be very convenient for us to use the notices system for this, since it avoids the need for editing the templates to include banners in specific nodes.
  6. Mike

    Mike 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.
    dutchbb likes this.

Share This Page