document.addEventListener("DOMContentLoaded", function () { if (!document.getElementById("rsResizer")) { /*console.log('Resizer script not found - loading resizer script');*/ var iframeResizer = document.createElement('script'); iframeResizer.setAttribute('type', 'text/javascript'); iframeResizer.setAttribute("src", "https://resources.ratesight.com/vendor/iframe-resizer/iframe-resizer.parent.js"); iframeResizer.setAttribute('id', 'rsResizer'); iframeResizer.setAttribute('crossorigin', 'anonymous'); document.body.appendChild(iframeResizer); } else { /*console.log('Resizer already loaded');*/ } let formId = 'rs-leadForm-iframe-153'; let rsFormWidgetFrame = document.createElement('iframe'); rsFormWidgetFrame.setAttribute('id', formId); rsFormWidgetFrame.setAttribute('name', formId); rsFormWidgetFrame.height = "100"; rsFormWidgetFrame.width = "100%"; rsFormWidgetFrame.setAttribute("scrolling", "no"); rsFormWidgetFrame.setAttribute('style', 'border: 0px solid gray; width:100%; background-color: transparent;-webkit-animation: fadeIn .35s;animation: fadeIn .35s;'); rsFormWidgetFrame.setAttribute("src", "https://go.ratesight.com/Widgets/WidgetContent.ashx?typ=1&oid=2&fid=153"); rsFormWidgetFrame.setAttribute("onload", "resizeRSForm('rs-leadForm-iframe-153');"); let initFormjs = document.getElementById('rsForm-153'); initFormjs.appendChild(rsFormWidgetFrame); var parentElement = initFormjs.parentElement; parentElement.replaceChild(rsFormWidgetFrame, initFormjs); }); function resizeRSForm(formId) { /*console.log('Starting to resize form to id:' + formId);*/ iframeResize({ license: '1jy4dww5qzv-s54r73oxcn-v59f4kfgfz', checkOrigin: false, scrolling: false }, '#' + formId); }