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

    Embedding of Jotform: Browser always scrolls right down to JotForm

    Asked by Britta  on December 02, 2015 at 03:57 AM

    My JotForm is embedded in Shopify. Check it out here:

    https://skatch.myshopify.com/collections/portrait/products/pennpencil

     

    When loading the page, the browser jumps right down to the JotForm. This is not the desired behavior, it should not scroll anywhere.

    How can the "auto-focus" on JotForms be prevented?

    Page URL:
    https://skatch.myshopify.com/collections/portrait/products/pennpencil

    JotForm right check scroll href
  • Profile Image

    Answered by Sammy on December 02, 2015 at 06:10 AM

    Kindly remove the highlighted JavaScript code at the bottom of the iframe code.

    <iframe id="JotFormIFrame" onload="window.parent.scrollTo(0,0)" allowtransparency="true" src="https://form.jotform.com/53301726458960" frameborder="0" style="width:100%; height:539px; border:none;" scrolling="no"> </iframe>
     
    <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; } var isJotForm = (e.origin.indexOf("jotform") > -1) ? true : false; if(isJotForm && "contentWindow" in iframe && "postMessage" in iframe.contentWindow) { var urls = {"docurl":encodeURIComponent(document.URL),"referrer":encodeURIComponent(document.referrer)}; iframe.contentWindow.postMessage(JSON.stringify({"type":"urls","value":urls}), "*"); } }; if (window.addEventListener) { window.addEventListener("message", handleIFrameMessage, false); } else if (window.attachEvent) { window.attachEvent("onmessage", handleIFrameMessage); } if(window.location.href && window.location.href.indexOf("?") > -1) { var ifr = document.getElementById("JotFormIFrame"); var get = window.location.href.substr(window.location.href.indexOf("?") + 1); if(ifr && get.length > 0) { var src = ifr.src; src = src.indexOf("?") > -1 ? src + "&" + get : src + "?" + get; ifr.src = src; } } </script>

     

     

     

  • Profile Image

    Answered by skatch on December 03, 2015 at 11:01 PM

    Thanks Sammy, this worked.

    PS: There were 2 highlighted passages, only the 1st one looked related, so I only removed the 1st one.

  • Profile Image

    Answered by Sammy on December 04, 2015 at 12:13 AM

    Happy to hear the solution worked.

    If you do encounter any other difficulties please let us know and we will be happy to assist.