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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:58:20+00:00 2026-05-25T19:58:20+00:00

In javascript, is there anyway to query how large css/js files are, and how

  • 0

In javascript, is there anyway to query how large css/js files are, and how large image files are? I have a unique situation where I give a user a preview of a page, and that page can either be the full page, or google’s cached text-only version of the page. The text only version loads instantly.

Don’t think there is, but figured I would ask.

Maybe Google’s index also holds information on page load times, would anyone know how to query this load time?

I want to make my app consider loading the text version of a page if it recognizes that it will take a long time to load the full page.

What I might do is search through the html string for a page, and just count the number of http requests that will be made (each css link, script tag, and img tag) via string manipulation. If there are more than X requests that would be made by inserting and loading that page’s full html for the preview, then I’ll opt for the instant text version of the page.

  • 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-25T19:58:21+00:00Added an answer on May 25, 2026 at 7:58 pm

    You can try using AJAX like author of an answer done in THIS TOPIC.

    Making HEAD HTTP AJAX request can give you header information about given file without downloading its content.

    Here is the example from the link:

    var xhr = new XMLHttpRequest();
    xhr.open('HEAD', 'img/test.jpg', true);
    xhr.onreadystatechange = function(){
      if ( xhr.readyState == 4 ) {
        if ( xhr.status == 200 ) {
          alert('Size in bytes: ' + xhr.getResponseHeader('Content-Length'));
        } else {
          alert('ERROR');
        }
      }
    };
    xhr.send(null);
    

    For more info please visit the source where author did a great job showing that solution.

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

Sidebar

Related Questions

Is there anyway to automatically run javascript:window.print() when the page finishes loading?
Is there anyway to have javascript run when a XSL sheet has been applied
Is there anyway to create an image map in Flash/Flex, and have it as
is there anyway to create a unique ID for a browser within javascript? Im
Is there anyway to grab the referring URL using javascript, lets say the reffering
Is there any way that I can call a JavaScript function via css? For
This is kind of unusual, but is there anyway to add text into JavaScript
I want prevent user to select dropdown list items using javascript methods. Is there
Is there anyway to detect if a JavaScript object is a regex? For example,
Hiall, is there anyway to stop running Javascript through Webkit inspector? I am trying

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.