title: Error: Permission denied to access property 'document'
body: <p>I am continuously getting the error <code>"Error: Permission denied to access property 'document'"</code> while i have already define in my <code>X-FRAME options</code> to allow the other domain, like this..</p>
  
  <pre><code> &lt;?php
          header('X-Frame-Options: ALLOW-FROM http://mydomain.com'); 
      ?&gt;
  </code></pre>
  
  <p>Below is the header of iframe request, clearly shows i have defined to allow the domain to access the iframe but not working. All i want is to resize the iframe using javascript.</p>
  
  <p><img src="https://i.stack.imgur.com/HoBiD.png" alt="enter image description here"></p>
  
  <p>Here is my javascript code to resize the iframe height.</p>
  
  <pre><code>&lt;iframe src="http://mydomain.com/xxx/yyy" id="idIframe" onload="iframeLoaded();" allowtransparency="true" frameborder="0" width="100%" scrolling="no"&gt;&lt;/iframe&gt;
  &lt;script type="text/javascript"&gt;
  function iframeLoaded() {
      var iFrameID = document.getElementById('idIframe');
      if(iFrameID) {
            iFrameID.height = "";
            if(iFrameID.contentWindow.document.body.scrollHeight &lt; 500) {
                iFrameID.height = "500px";
            } else {
                iFrameID.height = iFrameID.contentWindow.document.body.scrollHeight + "px";
            }
      }   
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>How can i do this? Please suggest.</p>