Guest User

Untitled

a guest
Feb 4th, 2023
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.11 KB | None | 0 0
  1.  
  2. <iframe
  3. id="JotFormIFrame-230343793930053"
  4. title="Form"
  5. onload="window.parent.scrollTo(0,0)"
  6. allowtransparency="true"
  7. allowfullscreen="true"
  8. allow="geolocation; microphone; camera"
  9. src="https://form.jotform.com/230343793930053"
  10. frameborder="0"
  11. style="
  12. min-width: 100%;
  13. height:539px;
  14. border:none;"
  15. scrolling="no"
  16. >
  17. </iframe>
  18. <script type="text/javascript">
  19. var ifr = document.getElementById("JotFormIFrame-230343793930053");
  20. if (ifr) {
  21. var src = ifr.src;
  22. var iframeParams = [];
  23. if (window.location.href && window.location.href.indexOf("?") > -1) {
  24. iframeParams = iframeParams.concat(window.location.href.substr(window.location.href.indexOf("?") + 1).split('&'));
  25. }
  26. if (src && src.indexOf("?") > -1) {
  27. iframeParams = iframeParams.concat(src.substr(src.indexOf("?") + 1).split("&"));
  28. src = src.substr(0, src.indexOf("?"))
  29. }
  30. iframeParams.push("isIframeEmbed=1");
  31. ifr.src = src + "?" + iframeParams.join('&');
  32. }
  33. window.handleIFrameMessage = function(e) {
  34. if (typeof e.data === 'object') { return; }
  35. var args = e.data.split(":");
  36. if (args.length > 2) { iframe = document.getElementById("JotFormIFrame-" + args[(args.length - 1)]); } else { iframe = document.getElementById("JotFormIFrame"); }
  37. if (!iframe) { return; }
  38. switch (args[0]) {
  39. case "scrollIntoView":
  40. iframe.scrollIntoView();
  41. break;
  42. case "setHeight":
  43. iframe.style.height = args[1] + "px";
  44. if (!isNaN(args[1]) && parseInt(iframe.style.minHeight) > parseInt(args[1])) {
  45. iframe.style.minHeight = args[1] + "px";
  46. }
  47. break;
  48. case "collapseErrorPage":
  49. if (iframe.clientHeight > window.innerHeight) {
  50. iframe.style.height = window.innerHeight + "px";
  51. }
  52. break;
  53. case "reloadPage":
  54. window.location.reload();
  55. break;
  56. case "loadScript":
  57. if( !window.isPermitted(e.origin, ['jotform.com', 'jotform.pro']) ) { break; }
  58. var src = args[1];
  59. if (args.length > 3) {
  60. src = args[1] + ':' + args[2];
  61. }
  62. var script = document.createElement('script');
  63. script.src = src;
  64. script.type = 'text/javascript';
  65. document.body.appendChild(script);
  66. break;
  67. case "exitFullscreen":
  68. if (window.document.exitFullscreen) window.document.exitFullscreen();
  69. else if (window.document.mozCancelFullScreen) window.document.mozCancelFullScreen();
  70. else if (window.document.mozCancelFullscreen) window.document.mozCancelFullScreen();
  71. else if (window.document.webkitExitFullscreen) window.document.webkitExitFullscreen();
  72. else if (window.document.msExitFullscreen) window.document.msExitFullscreen();
  73. break;
  74. }
  75. var isJotForm = (e.origin.indexOf("jotform") > -1) ? true : false;
  76. if(isJotForm && "contentWindow" in iframe && "postMessage" in iframe.contentWindow) {
  77. var urls = {"docurl":encodeURIComponent(document.URL),"referrer":encodeURIComponent(document.referrer)};
  78. iframe.contentWindow.postMessage(JSON.stringify({"type":"urls","value":urls}), "*");
  79. }
  80. };
  81. window.isPermitted = function(originUrl, whitelisted_domains) {
  82. var url = document.createElement('a');
  83. url.href = originUrl;
  84. var hostname = url.hostname;
  85. var result = false;
  86. if( typeof hostname !== 'undefined' ) {
  87. whitelisted_domains.forEach(function(element) {
  88. if( hostname.slice((-1 * element.length - 1)) === '.'.concat(element) || hostname === element ) {
  89. result = true;
  90. }
  91. });
  92. return result;
  93. }
  94. };
  95. if (window.addEventListener) {
  96. window.addEventListener("message", handleIFrameMessage, false);
  97. } else if (window.attachEvent) {
  98. window.attachEvent("onmessage", handleIFrameMessage);
  99. }
  100. </script>
Advertisement
Add Comment
Please, Sign In to add comment