Add Title attribute to the iframe embed code

  • Profile Image
    webtools@heart.org
    Asked on August 25, 2017 at 05:04 PM
    Is there any solution to the issue where the thank you message appears at the top of the screen after submit other than to use the iframe option? I checked other responses in the forum and this seems to be the only solution. If this is the only solution can you all please add a Title attribute to the embed code for web accessibility purposes. You can find additional information regarding iframe titles and web accessibility here: https://www.w3.org/TR/WCAG20-TECHS/H64.html
  • Profile Image
    EltonCris
    Answered on August 25, 2017 at 07:09 PM

    Hi,

    There's actually an alternative solution, that's to redirect the form to your custom thank you page when it is submitted. This works better than using an iframe, in case iframe is your least option.

    With regards to the title, you can add it manually when you take your iframe embed code.

    Example:

     <iframe title="Documents" id="JotFormIFrame-72247349716968" onload="window.parent.scrollTo(0,0)" allowtransparency="true" src="https://form.jotformpro.com/72247349716968" frameborder="0" style="width: 1px; min-width: 100%; height:539px; border:none;" scrolling="no"> </iframe> <script type="text/javascript"> var ifr = document.getElementById("JotFormIFrame-72247349716968"); if(window.location.href && window.location.href.indexOf("?") > -1) { 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; } } window.handleIFrameMessage = function(e) { var args = e.data.split(":"); if (args.length > 2) { iframe = document.getElementById("JotFormIFrame-" + args[2]); } else { 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); } </script>

    Hope this helps!

  • Profile Image
    EltonCris
    Answered on August 25, 2017 at 07:19 PM

    I have also raised this as feature requests so the title attribute will be added to the iframe embed code by default. Then fill the title with the form name as its default value.