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 7172149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:33:29+00:00 2026-05-28T15:33:29+00:00

I want to preload a JS file and a CSS file from the landing

  • 0

I want to preload a JS file and a CSS file from the landing page to optimize the main site load, after the conversion in the landing. I was looking for information about this and finally tried to get this done using:

    var xhr = new XMLHttpRequest();
    xhr.open('GET', 'jsUrl');
    xhr.send('');
    xhr = new XMLHttpRequest();
    xhr.open('GET', 'cssUrl');
    xhr.send('');

With Firefox this great, but with Chrome it seems that the XHR calls are cached in a different cache than the css and js files.
We don´t use JQuery, the landing page must be lightweight (less load, more conversion rate).

Do you have any recommendation of another way to solve the original problem? (preload components)

Do you know how to make Chrome cache these requests?

  • 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-28T15:33:30+00:00Added an answer on May 28, 2026 at 3:33 pm

    This is a tested solution in a high volume site that works.

    First, to avoid a competition between the landing page resources and the preloaded resources for the bandwith you could delay the load with javascript:

    var prevOnLoad=window.onload;
    function onLoadPreloadComponents() {
        if(prevOnLoad) {
            try{
               prevOnLoad();
            }catch(err){
            }
        }
        preloadSiteComponents();
    }
    
    window.onload=onLoadPreloadComponents;
    

    This is not the way I solved this because in my use case a flash event (using the Flash to JS brigde) signals when the landing was finally loaded. But the previous code must works as well. When the load page event is fired by the browser this function will execute previous onLoad code and the preloading.

    I put an empty div cointainer where the iframe will be loaded.

    <div id="mainSiteComponentsContainer" style="display: none;">
    </div>
    

    And the function code is:

    function preloadSiteComponents() {
        try{
            document.getElementById('mainSiteComponentsContainer')
                .innerHTML=
                    "<iframe src=\"http://www-components.renxo-cdn.net/preload-site-components-data-url-scheme-version-1.2.84-css-1.0.53.html\" frameborder=\"no\" height=\"0px\" width=\"0px\"></iframe>";
        }catch(err) {
        }
    }
    

    As you could see, the link url to iframe is dynamic, it changes between differents plataform versions (different deployments) to avoid unwanted browser cache with a new deployments.

    The HTML that will be in the iframe could be something like this (for example):

    <html class=" gecko win js" xmlns="http://www.w3.org/1999/xhtml">
        <head>
            <meta content="noindex,nofollow" name="robots">
            <script src="http://www-components.renxo-cdn.net/scripts/lib-1.2.84.js" type="text/javascript">
            <link href="http://www-components.renxo-cdn.net/styles/skin-data-url-scheme-1.0.53.css" media="all" type="text/css" rel="stylesheet">
        </head>
        <body> </body>
    </html>
    

    Here you could see the links to the components that I want to preload.
    Finally, the div cointainer will have the iframe. After the onLoad event:

    <div id="mainSiteComponentsContainer" style="display: none;">
        <iframe width="0px" height="0px" frameborder="no" src="http://www-components.renxo-cdn.net/preload-site-components-data-url-scheme-version-1.2.84-css-1.0.53.html">
            <html class=" gecko win js" xmlns="http://www.w3.org/1999/xhtml">
                <head>
                    <meta content="noindex,nofollow" name="robots">
                    <script src="http://www-components.renxo-cdn.net/scripts/lib-1.2.84.js" type="text/javascript">
                    <link href="http://www-components.renxo-cdn.net/styles/skin-data-url-scheme-1.0.53.css" media="all" type="text/css" rel="stylesheet">
                </head>
                <body> </body>
            </html>
        </iframe>
    </div>
    

    You could see the working solution here.

    Use Firebug to see the delayed load of this components.

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

Sidebar

Related Questions

I'm not referring to preloading images, I want to preload an HTML page using
I'm looking to preload a website. I only want a loading bar once on
I want to preload (load into memory) about 10 jpg pictures (size 3264px x
I don't want to know a way to preload images, I found much on
I'm trying to preload about 150 images and I want to be able to
want to rewrite urls like site.com/software to wp-content/themes/dir/software.php and something is not working.. Here's
I'm working on a project that has a Main.fla and a Preload.fla. I am
AFAIK, a thread can not access UI components. But I want to preload images
I want to preload a lot of images when my app starts up, sort
I have a script that asynchronously loads image src from XML file. The sources

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.