• Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
v3.5.2 Latest
Buy Hosting

Assistance requested to reformat document.write from ad code javascript

Scheduled Pinned Locked Moved Technical Support
4 Posts 2 Posters 1.7k Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • rodR Offline
    rodR Offline
    rod
    wrote on last edited by
    #1

    I am working on integrating an advertising provider specific to the genre of my forum. The javascript code they provide uses the document.write element which I know does not behave with NodeBB.

    Would someone be willing to take a crack at tweaking the following ad code to work with this software?

    <!--BANNER 920x120 - DO NOT MODIFY-->
    <script type="text/javascript"><!--
    document.write('<s'+'cript type="text/javascript" src="https://fsadwork.com/show.php?z=32&pl=99&j=1&code='+new Date().getTime()+'"></s'+'cript>'); 
    // --></script>
    <noscript>
    <iframe src="https://fsadwork.com/show.php?z=32&pl=99" width="920" height="120" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"></iframe>
    </noscript>
    <!--BANNER 920x120 - DO NOT MODIFY-->
    

    I think the <noscript> ... </noscript> stuff at the end could probably go away since NodeBB requires javascript but I don't know how I would take the document.write line and reformat it to use, let's say, document.getElementById (or some other tag).

    All help is greatly appreciated.
    Thanks in advance.

    1 Reply Last reply
    0
  • GiggiuxG Offline
    GiggiuxG Offline
    Giggiux
    wrote on last edited by
    #2
    <script type="text/javascript" src="https://fsadwork.com/show.php?z=32&pl=99&j=1&code='+new Date().getTime()+'"></script>
    <noscript>
    <iframe src="https://fsadwork.com/show.php?z=32&pl=99" width="920" height="120" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"></iframe>
    </noscript>
    

    try this...?

    rodR 1 Reply Last reply
    0
  • rodR Offline
    rodR Offline
    rod
    replied to Giggiux on last edited by
    #3

    @Giggiux That does not work. Nothing is displayed.

    While looking at my "browser console" I see this error:

    TypeError: document.write is not a function[Learn More] show.php:2:3
    <anonymous> https://fsadwork.com/show.php:2:3

    So it seems that show.php is forcing a document.write also.

    I sent off a support request to the ad publisher system and am hoping they will offer their ad code that is better suited for NodeBB.

    GiggiuxG 1 Reply Last reply
    0
  • GiggiuxG Offline
    GiggiuxG Offline
    Giggiux
    replied to rod on last edited by Giggiux
    #4

    @rod Ohh I see what it does...
    mhm since is in nodebb try:

    $.get('https://fsadwork.com/show.php?z=32&pl=99&j=1&code='+new Date().getTime(), function(data) {
        document.getElementById("YOURTAG").innerHTML = data.replace('document.write(','').replace(')','')
    });
    <noscript>
    <iframe src="https://fsadwork.com/show.php?z=32&pl=99" width="920" height="120" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"></iframe>
    </noscript>
    

    But this probably will not work because they'll have cross-origin ajax control.

    And of course you need to change "YOURTAG" with the id of where you want the ads to appear.

    If it doesn't work.. I don't know then how could you change it 😛

    1 Reply Last reply
    0

Copyright © 2023 NodeBB | Contributors
  • Login

  • Don't have an account? Register

  • Login or register to search.
Powered by NodeBB Contributors
  • First post
    Last post
0
  • Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development