I would like to load a banner that I know was created with openx, the code of the banner however, contains document.write commands meaning it clears the page when run out of an iframe (document.write clears page) and because my banner is expandable, I wanna load it into a div
Here's the banner's code:
<!--/* OpenX Javascript Tag v2.8.8 */-->
<script type='text/javascript'>
<!--//<![CDATA[
var m3_u = (location.protocol=='https:'?'https://www.aw04.net/ads/www/delivery/ajs.php':'http://www.aw04.net/ads/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=299");
document.write ('&cb=' + m3_r);
if (document.MAX_used != ',') document.write ("&exclude=" + document.MAX_used);
document.write (document.charset ? '&charset='+document.charset : (document.characterSet ? '&charset='+document.characterSet : ''));
document.write ("&loc=" + escape(window.location));
if (document.referrer) document.write ("&referer=" + escape(document.referrer));
if (document.context) document.write ("&context=" + escape(document.context));
if (document.mmm_fo) document.write ("&mmm_fo=1");
document.write ("'><\/scr"+"ipt>"); *///]]>-->
</script>
<noscript>
<a href='http://www.aw04.net/ads/www/delivery/ck.php?n=a47d7715&cb=INSERT_RANDOM_NUMBER_HERE' target='_blank'>
<img src='http://www.aw04.net/ads/www/delivery/avw.php?zoneid=299&cb=INSERT_RANDOM_NUMBER_HERE&n=a47d7715' border='0' alt='' />
</a></noscript>
Is there a way of loading this script unmodified to something not an iframe?
I overwrote the document.write with the following code:
var elementToWrite = null;
document.write = function () {
if (elementToWrite != null) {
elementToWrite.append([].concat.apply([], arguments).join(''));
}
};
Now I just have to set the elementToWrite variable with some element from jQuery, this actually broke a few things but nothing I can't fix from application code