What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.

  • Profile Image

    How to know what height to set iframe at?

    Asked by carecycle on September 15, 2015 at 09:37 PM

    for those of us who don't code & are just trying to embed a form, it would seem that jotform should just set the iframe height to match the form in the first place. how do we determine what height to set it at to get rid of all the extra space?

  • Profile Image
    JotForm Support

    Answered by ashwin_d on September 16, 2015 at 01:10 AM

    Hello carecycle,

    You can manually edit the height of your iFrame by editing the "Height" attribute of iFrame embed code: 


    <script type="text/javascript">window.handleIFrameMessage = function(e) {var args = e.data.split(":");var iframe = document.getElementById("JotFormIFrame");if (!iframe)return;switch (args[0]) {case "scrollIntoView":iframe.scrollIntoView();break;case "setHeight":iframe.style.height = args[1] + "px";break;case "collapseErrorPage":if (iframe.clientHeight > window.innerHeight) {iframe.style.height = window.innerHeight + "px";}break;case "reloadPage":window.location.reload();break;}};if (window.addEventListener) {window.addEventListener("message", handleIFrameMessage, false);} else if (window.attachEvent) {window.attachEvent("onmessage", handleIFrameMessage);}</script>

    Please be noted that when you copy your form's iFrame embed code, it also includes a script code as well. This script code will adjust the height of your form automatically. 

    Please share the webpage URL where you have embedded your form and we will help you fix the height issue.

    We will wait for your response.

    Thank you!