Inline Frame that automatically adjusts its height for the source page

Last year, I was working on our MULPROJ layout, and the type of layout I was making needed an iframe whose height is auto resized according to the source page’s content. This means that there should be no vertical scrollbar in the iframe, it simply adjusts itself vertically.

I thought that it wasn’t possible to do this but I found a JavaScript code that can do the trick, and I just want to share it with you. 😉

Save the above code as iframe.html, or whatever you like.
Remember to create the file yourPage.html in the same folder as your previous html file.

I stumbled upon it on: this forum thread.

I also did a little editing.

Catzie

A Filipino who is a mobile & web developer on weekdays, and a baker on weekends. When I have time to spare, I blog, play video games, watch series (usually anime), cook dishes, draw, or spend a little time with pets. I also like traveling and recording song covers, but I only do so occasionally. Follow on Twitter: @catzie

Leave a Reply

Your email address will not be published. Required fields are marked *