/* ---- Auto-height: parent listener ---- */(function () { var iframe = document.getElementById("uviz-iframe"); var CHILD_ALLOWED_ORIGIN = "https://rovingcondor.com"; // tighten security function setHeight(h) { // Apply a reasonable min/max guard if you want var clamped = Math.max(200, Math.min(h, 100000)); // 200px–100000px iframe.style.height = clamped + "px"; } // Listen for child messages window.addEventListener("message", function (e) { if (!e || !e.data) return; // Security: only accept from the expected child origin if (e.origin !== CHILD_ALLOWED_ORIGIN) return; if (e.data.type === "uvizHeight" && typeof e.data.height === "number") { setHeight(e.data.height); } }); // Ask the child for height when the iframe loads (handshake) function requestHeight() { try { iframe.contentWindow.postMessage({ type: "uvizRequestHeight" }, CHILD_ALLOWED_ORIGIN); } catch (err) { /* noop */ } } // Initial request(s) iframe.addEventListener("load", requestHeight); // Also request after viewport changes ["resize", "orientationchange"].forEach(function (ev) { window.addEventListener(ev, requestHeight, { passive: true }); }); // As a conservative fallback, ping again shortly after load setTimeout(requestHeight, 800);})();
Weiter zum vollständigen Artikel bei Mining.com Weiter zum vollständigen Artikel bei Mining.com