Get the loading status of the current document:
var x = document.readyState;
Click the button to display the loading status of the current document.
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/* w ww . java2 s . c o m*/ var x = document.readyState; document.getElementById("demo").innerHTML = x; } </script> </body> </html>
The readyState property returns the loading status of the current document.
This property is read-only.
Possible value:
Value | Meaning |
---|---|
uninitialized | Has not started loading yet |
loading | Is loading |
loaded | Has been loaded |
interactive | Has loaded enough and the user can interact with it |
complete | Fully loaded |