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

  • Home
  • SEARCH
  • 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 6114877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:01:37+00:00 2026-05-23T15:01:37+00:00

Is there a definitive JavaScript method for checking whether or not a web page

  • 0

Is there a definitive JavaScript method for checking whether or not a web page has loaded completely? Completely, meaning 100% complete. HTML, scripts, CSS, images, plugins, AJAX, everything!

As user interaction can effect AJAX, let’s assume there is no further user interaction with the page, apart from the initial page request.

  • 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-23T15:01:37+00:00Added an answer on May 23, 2026 at 3:01 pm

    What you’re asking for is pretty much impossible. There is no way to determine whether everything has loaded completely. Here’s why:

    • On a lot of webpages, AJAX only starts once the onload (or DOMReady) event fires, making the method of using the onload event to see if the page has loaded impossible.
    • You could theoretically tell if the webpage was performing an AJAX request by overriding window.XMLHttpRequest, but you still couldn’t tell if plugins like Flash were still loading or not.
    • On some sites, like Twitter.com, the page only loads once and simply makes AJAX requests to the server every time the user clicks a link. How do you tell if the page has finished loading on a page like that?
    • In fact, the browser itself can’t be completely certain whether the page has completely finished loading, or whether it’s about to make more AJAX requests.

    The only way to know for sure that everything loaded is to have every single piece of code on the page that loads something tell your code that it has finished once it loads.


    A hacky, incomplete solution: You could try overriding XMLHttpRequest with a function that wraps the existing XMLHttpRequest and returns it. That would allow you to tell if a AJAX event is currently taking place. However, that solution wouldn’t work for seeing if plugins are loaded, and you wouldn’t be able to tell the difference between AJAX events that are triggered at page load and AJAX requests that happen periodically, like the ones on Stack Overflow that change the Stack Exchange icon on the top-left if you have new notifications.

    Try something like this:

    (function(oldHttpRequest){
      // This isn't cross-browser, just a demonstration
      // of replacing XMLHttpRequest
    
      // Keep track of requests
      var requests_running = 0;
    
      // Override XMLHttpRequest's constructor
      window.XMLHttpRequest = function() {
        // Create an XMLHttpRequest
        var request = new oldHttpRequest();
    
        // Override the send method
        var old_send = request.send;
        request.send = function () {
          requests_running += 1;
          old_send.apply(request, arguments);
        };
    
        // Wait for it to load
        req.addEventListener("load", function() {
          requests_running -= 1;
        }, false);
    
        // Return our modified XMLHttpRequest
        return request;
      };
    
      window.addEventListener("load", function() {
        // Check every 50 ms to see if no requests are running
        setTimeout(function checkLoad() {
          if(requests_running === 0)
          {
            // Load is probably complete
          }
          else
            setTimeout(checkLoad, 50);
        }, 50);
      }, false);
    })(window.XMLHttpRequest)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Today is my first day in JavaScript. The book (JavaScript Definitive Guide) has an
Is there a definitive list for all of the functions available for a Sharepoint
Is there a definitive gem for the YouTube API? I'm trying to use youtube_g,
There appears to be no definitive standardized stack frame and C language calling conventions
I see there is a question here but there is no definite answer. Has
There is a conversion process that is needed when migrating Visual Studio 2005 web
Is there any way to randomly access the URLs in Javascript's History object in
I have an external javascript on my page, e.g. something like: <script src=http://foo.com/script.js type=text/javascript></script>
Influenced by jQuery, I'm experimenting with method chaining in javascript. I constructed a wrapper
I am reading Javascript The Definitive Guide. In this book, Events and Event handling,

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.