Monday, 12 August 2013

Reload page containting scripts and iframes

Reload page containting scripts and iframes

I have come accross unexpected problem. I have one ad on the side, it is
from some platform, similar to google ads, lets say.. since i dont have
pages but infinite scroll, i wanted to change the ad every time the
scroll() function is called, for appending more content. And i tried
simple changes with .html or innerHTML or jquery .text and so on. It works
if i change the div content with something simple like innerHTML('aaa');
or something like that.. but since ad is generated from script, when i try
to add something like this, it won't work, it makes no sense to me. What i
get is another ad and those 3 characters ->> ";}
function changeAd(){
document.getElementById('ad-container').innerHTML = '<script
type="text/javascript" src="http://aaaaa.ads.aaa.com"></script> ';
}
My guessing is that somehow string is concatinated to the string in that
script that is being loaded, and thats why it leaves those ";}
characters.. Any hints?

No comments:

Post a Comment