Categories
Iframe Jquery

Insert HTML content into an iFrame using jQuery

To Insert HTML content into an iFrame we can use jQuery contents() method. The jQuery contents() method will return all the direct childrens incliding text and comment nodes of the selected element.

Categories
Iframe Jquery

Make iframe automatically adjust height according to the contents in it using javascript (Support Cross-Domain)

In some pages in your application you may need to feed content form other domain or other pages from same domain using iFrame . We normally set width and height for the iFrame so if the content is bigger than iFrame, scroll will appear automatically. Here is the JavaScript that can fix height dynamically using window.postmessage() method.