Javascript DOM HTML Document readyState Property get

Introduction

Get the loading status of the current document:

var x = document.readyState;

Click the button to display the loading status of the current document.

View in separate window

<!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:

ValueMeaning
uninitialized Has not started loading yet
loading Is loading
loaded Has been loaded
interactive Has loaded enough and the user can interact with it
completeFully loaded



PreviousNext

Related