`; // Set the iframe content const iframe = document.getElementById('menu-iframe'); const blob = new Blob([iframeContent], { type: 'text/html' }); const url = URL.createObjectURL(blob); iframe.src = url; // Adjust iframe height based on content (optional) iframe.onload = function() { try { // Attempt to resize iframe based on content const iframeDocument = iframe.contentDocument || iframe.contentWindow.document; // Set up a resize observer for dynamic content const resizeObserver = new ResizeObserver(entries => { for (let entry of entries) { const height = entry.contentRect.height; if (height > 0) { iframe.style.height = height + 'px'; } } }); if (iframeDocument.body) { resizeObserver.observe(iframeDocument.body); } } catch (e) { // Cross-origin restrictions may prevent access console.log('Cannot access iframe content due to cross-origin restrictions'); } };