Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6671065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:20:37+00:00 2026-05-26T03:20:37+00:00

I have a beautifully slick and elegant website that loads in double quick time,

  • 0

I have a beautifully slick and elegant website that loads in double quick time, until of course the banner ads are enabled! Waiting to retrieve the adds up to 10 seconds on the the page load time which for me is really frustrating as I have spent ages optimising the rest of the site.

I have tried to load the adverts via ajax or similar with mixed success. The flash based banners and the ads which simply get a snippet of html from the ad server work fine. However, there are some (PaddyPower I am talking about you) which return javascript and use document.write() to append the html advert to the DOM. The advert is never displayed.

The affiliate code:

<script type="text/javascript" src="someadserver.com/impression.aspx"></script>

The script returned by someadserver.com

document.write('Normal HTML code')

It must have something to do with cross site scripting and security but I am no expert on this. Is there a way to achieve what I want?

I don’t believe caching is an option as it will skew the impressions/clickthrough statistics.

Also changing any affiliate code is not an option as it is a client’s website and I want a stable and workable solution that does not rely on hacking ad code.

—EDIT—

I modified my advert class to return the advert code surrounded by <noscript> tags and at the same time save the advert code in a static member. Just after my </body> tag I use this code here:

    <?php foreach(Advert::getCachedAds() as $id => $code): ?>
    <div class="advert <?php echo $id ?>" style="visibility:hidden;">
        <?php echo $code ?>
    </div>
    <?php endforeach; ?>
    <script type="text/javascript">
        $(function(){
            $('.adContainer').each(function(index, object){
                var advert = $('div.' + $(object).attr('id')).html();
                $('div.' + $(object).attr('id')).html('');
                $(object).html(advert);
            });
        });
    </script>

This works quite nicely and reminds me of the old-skool image pre-loader scripts we used to use in the days of Netscape and dial-up connections.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:20:37+00:00Added an answer on May 26, 2026 at 3:20 am

    You could put place-holder divs where you want your adverts to be, load the adverts after all the actual content has loaded and then move the loaded ads into place.

    This will not help with the overall speed of the page but will allow your actual content to be seen without having to wait for the ads to load.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My html page loads beautifully, but I have some JavaScript that adds a few
I have a codeigniter website that runs beautifully on localhost, but now that I
I have code that's working beautifully on my development machine, but when deployed to
I have a spring project that works beautifully when it's located at the web
I have a WPF app that works beautifully if I debug (F5) in Visual
I have a nav bar with a drop down that is working beautifully. The
I have an application that works beautifully in development mode. In an attempt to
I have a self-hosted WCF that runs under network_service beautifully on \Server1, but needs
I have hundreds of thousands of points of time series data that I want
I have a function that toggles hidden divs and works beautifully at it. unfortunately,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.