title: Get IFrame innerHTML using JavaScript
body: <p>I'm trying to get an IFrame inner HTML using below code.</p>
  
  <pre><code> &lt;iframe src="http://www.msn.com" 
           width="100%" height="100%" marginwidth="0"
           scrolling="no" frameborder="0" id="divInfo" 
           onreadystatechange="MyFunction(this);"&gt;&lt;/iframe&gt;   
  </code></pre>
  
  <p>JavaScript code is </p>
  
  <pre><code>  function MyFunction(frameObj)
      {
          if (frameObj.readyState == "complete")
          {
              alert(frameObj.document.body.innerHTML); 
          }
      }
  </code></pre>
  
  <p>But the alert shows me the html of current document. How can i get the inner HTML of iframe when the frmae ready state is complete.</p>
  
  <p>If i use <code>alert(frameObj.contentWindow.document.body.innerHTML);</code> it gives me Access is denied error.</p>
  
  <p>Thanks in advance.</p>