0

I have a iframe in aspx page i have to check the readyState conditions as shown below, please let me know how to get the readystate of iframe control using javascript.

<script language="javascript" type="text/javascript">
        window.onload = function () {      
            var iframe = document.getElementById('myframe').readyState;
            alert(iframe); // iframe is giving "undefined" here
        }
</script>


<div>
<iframe id="myframe" name="myframename" frameborder="1" src="about:blank"> </iframe>
</div>

thanks Ravi

Dhaval Marthak
  • 17,246
  • 6
  • 46
  • 68
Ravikumar_n
  • 117
  • 1
  • 3
  • 11

1 Answers1

1

That's because the iFrame itself does not have a readyState. You'll need to access the contentWindow (child of the iFrame) to get that result. See document.readyState not working in Firefox and Chrome (and some more here: Iframe.readyState does not work in chrome )

Community
  • 1
  • 1
Leon
  • 919
  • 6
  • 21