HI How can i load the Advertising banner code after the website has been fully loaded? I searched google for a long time for this but i couldn't find any useful solution for it. I hop someone here can help me because this 2 Advertising banners slow me site load down.
first comment-out the add code inside its container.. <div id="ad1"><!-- the ad code here --></div> <div id="ad2"><!-- the ad code here --></div> <script type="text/javascript"> document.body.onload = function() { var ad1 = document.getElementById('ad1'); ad1.innerHTML = ad1.firstChild.data; var ad2 = document.getElementById('ad2'); ad2.innerHTML = ad2.firstChild.data; } </script> HTML:
THX i added this script to the website but i don't see any improvements in the loud time. <div id="ad1" style="text-align: center"> <script type="text/javascript"> var AdBrite_Title_Color = 'EFEFEF'; var AdBrite_Text_Color = 'EFEFEF'; var AdBrite_Background_Color = '2E2E2E'; var AdBrite_Border_Color = '2E2E2E'; var AdBrite_URL_Color = 'F26321'; try{var AdBrite_Iframe=window.top!=window.self?2:1;var AdBrite_Referrer=document.referrer==''?document.location:document.referrer;AdBrite_Referrer=encodeURIComponent(AdBrite_Referrer);}catch(e){var AdBrite_Iframe='';var AdBrite_Referrer='';} </script> <script type="text/javascript">document.write(String.fromCharCode(60,83,67,82,73,80,84));document.write(' src="http://ads.adbrite.com/mb/text_group.php?sid=2016176&zs=3136305f363030&ifr='+AdBrite_Iframe+'&ref='+AdBrite_Referrer+'" type="text/javascript">');document.write(String.fromCharCode(60,47,83,67,82,73,80,84,62));</script> </div> <script type="text/javascript"> document.body.onload = function() { var ad1 = document.getElementById('ad1'); ad1.innerHTML = ad1.firstChild.data; } </script> Code (markup):
If i understand this right then i think i need to copy the code <div id="ad1"><!-- my ad code --></div> Code (markup): At the bottom of the </body> tag. And the javascript i place where the advertising banner should be displayed. But if i do that the advertising banner will not show up did i do something wrong?
Basically, what you want to do is to add the AD code with JavaScript on your page after the page is loaded. Here's how you call a function after the page is loaded function init() { // code here will get executed after load } // Call init on load window.onload = init; Now in your init() function, add the JavaScript code of your add to your page. Read http://unixpapa.com/js/dyna.html for more info!
I tried this on he script of mycorrent new ad network but it doesn't work. <script language="javascript"> function init(){ <script src="http://cpm.biz/fixed.php?ad=60koq&u=ebykr4&w=160&h=600&s=d8i65b" type="text/javascript"></script> } window.onload=init; </script>
Try changing post #3 to <div id="ad1" style="text-align: center"> </div> <script type="text/javascript"> document.body.onload = function() { var AdBrite_Title_Color = 'EFEFEF'; var AdBrite_Background_Color = '2E2E2E'; var AdBrite_Border_Color = '2E2E2E'; var AdBrite_URL_Color = 'F26321'; try{ var AdBrite_Iframe=window.top!=window.self?2:1; var AdBrite_Referrer=document.referrer==''?document.location:document.referrer; AdBrite_Referrer=encodeURIComponent(AdBrite_Referrer); } catch(e){ var AdBrite_Iframe=''; var AdBrite_Referrer=''; } document.write(String.fromCharCode(60,83,67,82,73,80,84)); document.write('src="http://ads.adbrite.com/mb/text_group.php?sid=2016176&zs=3136305f363030&ifr='+AdBrite_Iframe+'&ref='+AdBrite_Referrer+'" type="text/javascript">'); document.write(String.fromCharCode(60,47,83,67,82,73,80,84,62)); var ad1 = document.getElementById('ad1'); ad1.innerHTML = ad1.firstChild.data; } </script> Code (markup): Note: I didn't test this, I just rewrote the order in which you did things, since doing it your way loaded the ad before the page finished loading - so there may be some errors.
It's very simple and achievable. There is two approaches: -Using CSS: Set background-image through CSS and all major browsers will load it last. Your page will be rendered even before your images are loaded. -Using JS: Someone above gave an example but I think it wasn't completely right. You need to execute code that will load image after document is rendered( or "load"). This is easy. If you using jQuery you can use "onReady" event. If you're not, you can use: window.onload = function () { your code here; } Now, say you have a div with id "myBanners" somewhere in HTML. Inside it, you want your images to be stored, but right after page is loaded. In "onload" function do: -select div "myBanners" -Create new image tag -Place image tag inside myBanners div. So: var img = new Image(); img.src = "pathToImage/image.jpg"; document.getElementById('myBanners').appendChild(img); Code (markup): And there you go. I would advise not to use iFrame solution. There are couple of reasons
Hey there, I also have this same problem and cant solve it. Can anyone help me? I did not find any solution to this in the entire internet... I just know that scripts with sources can only be loaded before the document has finished loading.
There's a big question that need to be asked and/or information you failed to provide that are pretty much required for anyone to provide a meaningful answer -- I find it disturbing people started posting code or attempting to answer without asking this... WHAT advertising service are you using and/or what does the code you already have look like? Everything people are saying here is complete nonsense without having that answered first! Adsense? Adbright? Some other scam? Without knowing what code you already have how can ANYONE possibly provide a meaningful and working answer?!? Herpafreakingderp people! ... of course my answer would be to rip the adverts out completely, but that's because I don't believe in advertising as a viable revenue source -- since don't see ads on websites as I run an adblock and set them up for EVERYONE I know and every machine that goes out my door, and trust online advertisers about as far as I could throw "The big stick". thinking them all a bunch of sleazeball scumbags... but then, I'm a pre dotcom-burst veteran.
Only a matter of time till users get punished for using a AdBlocker google is already doing this at Brazilian visitors. And i'm also doing this but for every user.
Works both ways, anyone pulling that type of stunt is very likely to have users go "Yeah, and **** you too buddy!" Since there are plenty of other websites out there without that type of asshattery. I automatically assume anyone blocking users running an adblock is just trying to install malware, viruses, and other sleazy crap that means I don't want to visit that website in the first place -- same policy I have for sites that 'require' activeX or have no scripting off graceful degradation. People want to be sleazeball shits in making their websites, I'm going to call them and treat them as sleazeball shits. ... and when it comes to the Internet the past year or two, I've not seen so many desperate sleazeball shits since the year or two leading up to the original dotcom burst and it's corresponding "advertisting can pay for everything" grade A farm fresh manure.
Do your really think this forum and a lot of other big websites would still exists without Ads or premium accounts? Think again. And by the way i also saw a Ad revenue increase by punishing leechers (AdBlcokers) on my websites.