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 Mylene 1 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.