Share via


Scaling Pages in Hosted HTML Applications

Hosted HTML applications rely on the CSS zoom property to scale pages automatically by passing a scaling value any time the onScaleEvent fires. This occurs when a page loads and any time the display resolution is changed in real time. The following example shows how to use the CSS zoom property in a handler for onScaleEvent:

JScript

    function onScaleEvent(vScale)
    {
        try
        {
            MyBody.style.zoom=vScale;
        }
        catch(e)
        {
            // Ignore the error.
        }
    } 

HTML

    <body id="body">

While it is possible to create custom scaling algorithms that don't rely on the onScaleEvent, it is not recommended. DHTML with the CSS zoom property allows you to place objects and elements with absolute positioning and then scale the entire page as a whole, which is more efficient.

See Also