ppbb123 Posted August 7, 2013 Report Share Posted August 7, 2013 How to resize an iFrame based on the content being loaded in it? My Iframe code is like: <iframe width="100%" id="myFrame" src="URL.htm" scrolling="no" frameborder="0" "> Thanks BoloMinoriLop 1 Quote Link to comment Share on other sites More sharing options...
0 nirmalab Posted August 7, 2013 Report Share Posted August 7, 2013 Hello, I think I may have a script that will help you, place this script in the webpage or the DataPage where you have iframe: =================================<head><script>function iframeLoad(){var iframe = document.getElementById("myFrame");var x = 100; //This is padding of the iframe if there’s anyvar height = iframe.contentWindow.document.body.scrollHeight + x;iframe.style.height = height+"px";}window.onload=iframeLoad;</script></head><body onload="iframeLoad()"><iframe id="myFrame" src="URL.htm">Sorry, but your browser does not support frames.</iframe></body> ================================= Basically within the body, you will need to place the iframe deployment code with the unique id for the iframe. I hope this helps. Thanks Quote Link to comment Share on other sites More sharing options...
0 MayMusic Posted August 7, 2013 Report Share Posted August 7, 2013 Thank you for sharing this code. Quote Link to comment Share on other sites More sharing options...
0 nirmalab Posted August 7, 2013 Report Share Posted August 7, 2013 Another important point to note: the webpage on which the script is placed should be the same domain as specified in the iframe code src tag, in your case "URL.htm". Quote Link to comment Share on other sites More sharing options...
0 MayMusic Posted August 7, 2013 Report Share Posted August 7, 2013 Can we have the compelete URL in case if we want to have the page deployed some where else with a different domain? Quote Link to comment Share on other sites More sharing options...
0 cflapt Posted October 31, 2013 Report Share Posted October 31, 2013 This code doesn't work on my datapage. I have a datapage (http://b6.caspio.com/embedded form...) embedded on my site (www.site.com) within a table. I then have another datapage (search and report, list results only; http://b6.caspio/iframe form...) within in iframe on the details page of the embedded form, ie. <iframe>src=http://b6.caspio/iframe form...</iframe>. The iframe is within a table, the code of which is in a HTML block of http://b6.caspio.com/embedded form... Here is the code within the html block of http://b6.caspio.com/embedded form... <table width="200" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="200" height="112" valign="top"><iframe frameborder=no; scrolling="no"; style="width:100%; height:400px" name="contact_form" title="contact_form" src="http://b6.caspio/iframe form...">Sorry, but your browser does not support frames.</iframe> </tr> <tr> <td height="105" valign="top"></td> </tr> <tr> <td height="100" valign="top"></td> </tr> </table> Thanks for the help. Quote Link to comment Share on other sites More sharing options...
0 cheonsa Posted May 25, 2023 Report Share Posted May 25, 2023 Hi all! Just to give you an update, here's the howto article to automatically adjust the height of an iFrame in embedded DataPages. https://howto.caspio.com/tech-tips-and-articles/embedding-datapages-with-automatic-height-adjustment/ Quote Link to comment Share on other sites More sharing options...
Question
ppbb123
How to resize an iFrame based on the content being loaded in it?
My Iframe code is like:
Thanks
Link to comment
Share on other sites
6 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.