I'd really like it if I could 'feed' the adsense system the dynamic content from the page, but apparently it doesn't work like that.
I don't like the idea of having ads for fireplaces or sonic software being shown all the time, so if it doesn't improve in a few days I'll probably pull it off.
Making it refresh is pretty easy. Create a
div for your adsense ad, put your adsense code into it and then call this function to refresh it:The content argument is there so I could experiment with feeding it content (which doesn't work).
/* Refresh the Google Ad iframe
*/
function refreshAd( content ) {
var d=document.getElementById('adsense');
if(d){
var s=d.getElementsByTagName('iframe');
if(s && s.length){
s[0].src=s[0].src+'&'+new Date().getTime();
}
}
return true;
}

3 comments:
did you ever solve this problem with that refresh() function?
The url will be longer and longer over time. Use this code instead:
var src = (s[0].src.split(/&xtime=/))[0];
s[0].src = src + '&xtime='+new Date().getTime();
Thanks, I discovered that as I was trying to get things working.
No, I never solved it and finally have in and made a more 'static' page.
Post a Comment