Assistance requested to reformat document.write from ad code javascript
-
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 thedocument.write
line and reformat it to use, let's say,document.getElementById
(or some other tag).All help is greatly appreciated.
Thanks in advance. -
<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...?
-
@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.
-
@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