Advertisement
Guest User

iFrame code

a guest
Dec 8th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 3.23 KB | None | 0 0
  1.     <iframe
  2.       id="JotFormIFrame-83386324138864"
  3.       onload="window.parent.scrollTo(0,0)"
  4.       allowtransparency="true"
  5.       allowfullscreen="true"
  6.       allow="geolocation; microphone; camera"
  7.       src="https://form.jotform.co/83386324138864"
  8.       frameborder="0"
  9.       style="width: 1px;
  10.      min-width: 100%;
  11.      height:100%;
  12.      border:none;"
  13.       scrolling="no"
  14.     >
  15.     </iframe>
  16.     <script type="text/javascript">
  17.       var ifr = document.getElementById("JotFormIFrame-83386324138864");
  18.       if(window.location.href && window.location.href.indexOf("?") > -1) {
  19.         var get = window.location.href.substr(window.location.href.indexOf("?") + 1);
  20.         if(ifr && get.length > 0) {
  21.           var src = ifr.src;
  22.           src = src.indexOf("?") > -1 ? src + "&" + get : src  + "?" + get;
  23.           ifr.src = src;
  24.         }
  25.       }
  26.       window.handleIFrameMessage = function(e) {
  27.         if (typeof e.data === 'object') { return; }
  28.         var args = e.data.split(":");
  29.         if (args.length > 2) { iframe = document.getElementById("JotFormIFrame-" + args[(args.length - 1)]); } else { iframe = document.getElementById("JotFormIFrame"); }
  30.         if (!iframe) { return; }
  31.         switch (args[0]) {
  32.           case "scrollIntoView":
  33.             iframe.scrollIntoView();
  34.             break;
  35.           case "setHeight":
  36.             // iframe.style.height = args[1] + "px";
  37.             break;
  38.           case "collapseErrorPage":
  39.             if (iframe.clientHeight > window.innerHeight) {
  40.               iframe.style.height = window.innerHeight + "px";
  41.             }
  42.             break;
  43.           case "reloadPage":
  44.             window.location.reload();
  45.             break;
  46.           case "loadScript":
  47.             var src = args[1];
  48.             if (args.length > 3) {
  49.                 src = args[1] + ':' + args[2];
  50.             }
  51.             var script = document.createElement('script');
  52.             script.src = src;
  53.             script.type = 'text/javascript';
  54.             document.body.appendChild(script);
  55.             break;
  56.           case "exitFullscreen":
  57.             if      (window.document.exitFullscreen)        window.document.exitFullscreen();
  58.             else if (window.document.mozCancelFullScreen)   window.document.mozCancelFullScreen();
  59.             else if (window.document.mozCancelFullscreen)   window.document.mozCancelFullScreen();
  60.             else if (window.document.webkitExitFullscreen)  window.document.webkitExitFullscreen();
  61.             else if (window.document.msExitFullscreen)      window.document.msExitFullscreen();
  62.             break;
  63.         }
  64.         var isJotForm = (e.origin.indexOf("jotform") > -1) ? true : false;
  65.         if(isJotForm && "contentWindow" in iframe && "postMessage" in iframe.contentWindow) {
  66.           var urls = {"docurl":encodeURIComponent(document.URL),"referrer":encodeURIComponent(document.referrer)};
  67.           iframe.contentWindow.postMessage(JSON.stringify({"type":"urls","value":urls}), "*");
  68.         }
  69.       };
  70.       if (window.addEventListener) {
  71.         window.addEventListener("message", handleIFrameMessage, false);
  72.       } else if (window.attachEvent) {
  73.         window.attachEvent("onmessage", handleIFrameMessage);
  74.       }
  75.       </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement