!function() { var iframe = document.createElement('iframe') var loader = document.getElementById('gorgias-contact-form-loader') var parentUrl = window.location.href var src = 'https://my-pet-chicken-help-center.gorgias.help/en-US/embed/contact' iframe.src = src iframe.id = 'gorgias-contact-form' iframe.height = '100%' iframe.width = '100%' iframe.setAttribute('frameborder', '0') iframe.setAttribute('scrolling', 'no') var parent = document.querySelector('#gorgias-contact-form-wrapper') function appendIframe () { parent.appendChild(iframe) } if (document.readyState === 'loading') { document.addEventListener("DOMContentLoaded", appendIframe) } else { appendIframe() } // Listen to messages from child window window.addEventListener("message", function (event) { // When the child sends the message that it's loaded, we can remove the loader and send back the parentUrl if (event.data.type === "gorgias-contact-form-loaded") { iframe.contentWindow.postMessage({ type: "gorgias-parent-url", parentUrl: parentUrl }, "*") if (loader) { parent.removeChild(loader) } } // When the child sends the message with its new height, we update the iframe height if (event.data.type === "gorgias-adjust-iframe-height") { iframe.setAttribute('height', event.data.height) } }) }()