Search code examples
javascriptbrowserloadingpage-lifecycle

Check through Javascript that page is loading something


When the browser is loading something on a page you can see it in the status bar that it says "Waiting for..." or "Transfering..." etc.

In firebug you can check in the net tab when something is being loaded and see when it stops. That is what I want.

Is there a way for me to trigger an event when that happens ? Or to get the status of the page or something ? Any way for me to know when that changes ?

I know I can do this easier if I use Ajax, but I can't since the page it's expecting an Excel report.

Thanks


Solution

  • Before the request for the page, do something like this:

    document.getElementById('status').innerHTML = 'loading...';
    
    /*
     * Load the object here
     */
    
    document.getElementById('status').innerHTML = '';