From 632e26f9fb1758d3b9b957322c0c1a890441503c Mon Sep 17 00:00:00 2001 From: Greg Gauthier Date: Wed, 3 Jul 2024 00:14:27 +0100 Subject: [PATCH] workaround for the iframe height problem --- web/index.html | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/web/index.html b/web/index.html index d7466bf..8acf61a 100644 --- a/web/index.html +++ b/web/index.html @@ -139,13 +139,24 @@ function loadContent(pageUrl) { var iframe = document.createElement('iframe'); iframe.src = pageUrl; - iframe.style.width = '100%'; // make the iframe take full width of the container - iframe.style.border = 'none'; // hide the border - iframe.style.overflow = 'hidden'; // hide scrollbars, can be 'auto' if you prefer automatic scrollbars - iframe.style.height = '800px'; // set a height so that the iframe is visible, adjust as per your needs + iframe.style.width = '100%'; + iframe.style.border = 'none'; + iframe.onload = function() { + iframe.style.height = iframe.contentWindow.document.body.scrollHeight + 'px'; + }; document.getElementById("toolPanel").innerHTML = ''; document.getElementById("toolPanel").appendChild(iframe); } +// function loadContent(pageUrl) { +// var iframe = document.createElement('iframe'); +// iframe.src = pageUrl; +// iframe.style.width = '100%'; // make the iframe take full width of the container +// iframe.style.border = 'none'; // hide the border +// iframe.style.overflow = 'hidden'; // hide scrollbars, can be 'auto' if you prefer automatic scrollbars +// iframe.style.height = '800px'; // set a height so that the iframe is visible, adjust as per your needs +// document.getElementById("toolPanel").innerHTML = ''; +// document.getElementById("toolPanel").appendChild(iframe); +// } \ No newline at end of file