bogdan.mustiata
bogdan.mustiata

Reputation: 1845

How to check when the document has started loading, document.readyState is not updated

When clicking a link in Firefox 10, the document.readyState == 'complete' until the request from the server actually returns.

Is there a cross-browser way to check if there is a request in progress or not by looking at the current document?

Upvotes: 1

Views: 357

Answers (1)

jfriend00
jfriend00

Reputation: 707308

If this clicking a link is going to a new page, a new document is created to load the page into so you won't ever see a status change on the current document other than an onunload handler.

You can see when your document is being unloaded with window.onunload. There are some browser differences in implementation as this is not a standard's-backed feature, but it does work in modern browsers.

Upvotes: 1

Related Questions