Mylene Posted November 2, 2017 Report Share Posted November 2, 2017 Hey everyone I wonder if someone has a solution for resizing an iframe depending on size of content. I have an html datapage and need to deploy submission form in iframe and I'd like to avoid scrolling Thanks! Quote Link to comment Share on other sites More sharing options...
Mathilda Posted November 2, 2017 Report Share Posted November 2, 2017 Just now, Mylene said: Hey everyone I wonder if someone has a solution for resizing an iframe depending on size of content. I have an html datapage and need to deploy submission form in iframe and I'd like to avoid scrolling Thanks! I have a solution for your case. You may find code below: <script>https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script> function resizeIframe(obj) { obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px'; } </script> <iframe src="URL_of the datapage" frameBorder="0" scrolling="no" width=100% onload="resizeIframe(this)">Sorry, but your browser does not support frames.</iframe> Don't forget to insert your URL instead of: URL_of the datapage Benades and Mylene 2 Quote Link to comment Share on other sites More sharing options...
Benades Posted March 16, 2023 Report Share Posted March 16, 2023 On 11/2/2017 at 12:53 PM, Mathilda said: I have a solution for your case. You may find code below: <script>https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script> function resizeIframe(obj) { obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px'; } </script> <iframe src="URL_of the datapage" frameBorder="0" scrolling="no" width=100% onload="resizeIframe(this)">Sorry, but your browser does not support frames.</iframe> Don't forget to insert your URL instead of: URL_of the datapage Of all the solutions some are earlier than this one, this has helped me to resize the iframe according to its content and not reorder all the content in some way. Thanks for the solution. Quote Link to comment Share on other sites More sharing options...
cheonsa Posted May 25, 2023 Report Share Posted May 25, 2023 Hi all! Caspio created a new article on their Howto page regarding the automatic resizing of iFrames embedded in DataPages. You may try the solution provided here: 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...
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.