IFrame resizing

Certain services, such as Redirect 3.0, support dynamic frame resizing. This allows an application to dynamically modify the height of the Healthx iframe which contains the application based on the height of the frame. To do this, add the following HTML and JavaScript to any page you would like to dynamically resize the Healthx frame.


<iframe id="inneriframe" width="10" height="10" style="display:none;"></iframe>
<script type="text/javascript">
    function hxOnLoad() { 
        var height = Math.max(document.body.offsetHeight, document.body.scrollHeight);
        if (height === 0) {
            height = document.documentElement.clientHeight;
            if (height === 0) {
                height = 500;
            }
        }
        height += 35; // padding
        document.getElementById('inneriframe').src = 'https://secure.healthx.com/ifr.html?height=' + height;
    }

if (window.addEventListener) // W3C standard
{
 window.addEventListener('load', hxOnLoad, false); // NB **not** 'onload'
else if (window.attachEvent) // Microsoft
{
 window.attachEvent('onload', hxOnLoad);
}
</script>
Comments