Ralpharama Archive. The archive is almost 20 years old, this website is no longer maintained.

Home | New Writing | Old Writing | Cooking | Technical | Wine Making | Cocktails

Resize an iframe dynamically

Hits 2189 | Created 2011-06-08 | Modified 2011-06-10

I found it tricky to make an iframe change size (its height) as it loaded new content. This solution works on FF and IE.

This seems buggy in Chrome. The version I have that works in Chrome too creates the a div, then an iframe using javascript on loading of page then operates on the created elements as below. For some reason, Chrome doesn't seem to like the line about contentWindow. Any suggestions?

IFRAME resize example

If you find this useful, a nod towards my website, or a thanks would be appreciated :)

Make a Comment


Antispam Code (always a number)

Enter Code Above

Note: All HTML will be removed except for bold and italics. Links will not display. Line breaks are added automatically. Use <pre>...</pre> for code.


This item has the following tags:
javascript iframe tech code resize trick lite

Useful? Donate for hosting costs

All content copyright (c) Ralpharama