eagle
April 24, 2020, 3:07pm
1
I trying to use a JotForm embedded iFrame in a Blocs page and I see the form using Blocs Preview with Safari but when I publish it, the form does not show up in Safari.
I do have a work around:
Edit the exported page with HypeEdit
Find the JotForm iFrame code and select all of this code
Then replace the code with a clean copy of the same code
At this point everything works as expected.
It seems the exported code has some issue. I sent a message to @Norm
I am waiting to here back from him, but in the mean time if anybody is Using JotForm with blocks could add a JotForm to a blocs website using the current version of Blocs and see if you have the same issue?
Thanks
1 Like
eagle
April 24, 2020, 3:55pm
2
I created a test JotForm if anybody is willing to give it a try in a code widget and let me know your results.
Thanks
<iframe
id="JotFormIFrame-201145075858154"
title="Test Form"
onload="window.parent.scrollTo(0,0)"
allowtransparency="true"
allowfullscreen="true"
allow="geolocation; microphone; camera"
src="https://form.jotform.com/201145075858154"
frameborder="0"
style="
min-width: 100%;
height:539px;
border:none;"
scrolling="no"
>
</iframe>
<script type="text/javascript">
var ifr = document.getElementById("JotFormIFrame-201145075858154");
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) {
if (typeof e.data === 'object') { return; }
var args = e.data.split(":");
if (args.length > 2) { iframe = document.getElementById("JotFormIFrame-" + args[(args.length - 1)]); } 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;
case "loadScript":
var src = args[1];
if (args.length > 3) {
src = args[1] + ':' + args[2];
}
var script = document.createElement('script');
script.src = src;
script.type = 'text/javascript';
document.body.appendChild(script);
break;
case "exitFullscreen":
if (window.document.exitFullscreen) window.document.exitFullscreen();
else if (window.document.mozCancelFullScreen) window.document.mozCancelFullScreen();
else if (window.document.mozCancelFullscreen) window.document.mozCancelFullScreen();
else if (window.document.webkitExitFullscreen) window.document.webkitExitFullscreen();
else if (window.document.msExitFullscreen) window.document.msExitFullscreen();
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>
eagle
April 25, 2020, 12:57pm
3
@Norm
Ok, I found the problem the published code is using lazyload. When I take out the lazyload for the statement manually it works fine.
Norm is there a way to turn off lazyload?
Thanks
eagle
April 26, 2020, 11:05am
6
Thanks, that did the trick.
1 Like