Note that there are some explanatory texts on larger screens.

plurals
  1. POHTML5 Resize top-level document iframe from inside a nested iframe
    primarykey
    data
    text
    <p>The problem may seem hard to understand, so I will illustrate it as best I can.</p> <p>Say I have the following index.html body:</p> <pre><code>&lt;iframe name="parent"&gt;&lt;/iframe&gt; </code></pre> <p>And inside the <code>parent</code> iframe, I load the following page body:</p> <pre><code>&lt;iframe name="nested-navigation"&gt;&lt;/iframe&gt; &lt;iframe name="nested-parent"&gt;&lt;/iframe&gt; </code></pre> <p>And inside <code>nested-parent</code> iframe, I load another page. Inside this other page, I need to somehow get to the top-level (index.html) documents <code>parent</code> iframe, so that I can resize the height of its contents using the <code>nested-parent</code> iframe content size. </p> <p>I correctly resize the index.html's <code>parent</code> iframes height using the loaded contents of the nested pages body. However, in the next nesting, I am unable to reach the <code>index.html</code> document context, and thus am unable to get the <code>parent</code> iframe element.</p> <p>I need help on figuring out how to reach the index.html's <code>parent</code> iframe. How would I do this?</p> <p>The page is online and the effects can be viewed here:</p> <p>www.ngeneersinc.com</p> <p>If you click the <code>Projects</code> navigation link, it will correctly load the page and resize the <code>parent</code> iframe. Sadly, when you click on the <code>Ngen</code> navigation link inside this nested page, the top-level (index.html) iframe (<code>parent</code>) does not get resized and the content is cut to whatever the height was set to in the previous page.</p> <p>EDIT:</p> <p>Essentially, I am trying to do the following in my javascript function:</p> <pre><code>var e = document.getElementById("nested-parent").contentWindow; // which is OK var x = e.contentWindow; // which is 'undefined' because I lost the context of the index.html document </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload