window.addEventListener("load", function() { fetch('https://4work.click/embed/project?id=65519d6712810a3b6ac266b7') .then(response => response.text()) .then(htmlString => { var iframe = document.createElement('iframe'); iframe.style.border = 'none'; iframe.style.width = '100%'; var container = document.querySelector('#my-project-4w-65519d6712810a3b6ac266b7'); container.appendChild(iframe); iframe.onload = function() { var scripts = Array.from(iframe.contentDocument.querySelectorAll('script')); scripts.forEach(oldScript => { var newScript = document.createElement('script'); if (oldScript.src) { newScript.src = oldScript.src; } else { newScript.textContent = oldScript.textContent; } iframe.contentDocument.body.appendChild(newScript); }); var contentHeight = iframe.contentDocument.body.scrollHeight; iframe.style.height = contentHeight + 'px'; }; iframe.contentDocument.open(); iframe.contentDocument.write(htmlString); iframe.contentDocument.close(); }); });