@addison
To auto-size an iframe in an Apex application, you can use JavaScript to dynamically resize the iframe based on the content inside it. Here's a step-by-step guide to achieve this:
1
|
<iframe id="myIframe" src="https://www.example.com"></iframe> |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
<script type="text/javascript"> $(document).ready(function() { var iframe = document.getElementById('myIframe'); iframe.onload = function() { var iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow; if (iframeWin.document.body) { iframe.height = iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.scrollHeight; } }; }); </script> |
1
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> |
With this code in place, the iframe will automatically adjust its height based on the content inside it whenever the content changes. This approach ensures that the iframe is always correctly sized to fit its content.