Handling Navigator Window Resizing

Navigator 4 has a nasty habit of destroying the layout of positioned elements (including LAYER elements) if the user resizes the browser window. The user may see overlapped text and elements shaped very peculiarly after the resize. There is a scripted workaround you should include in all pages that use positioned elements.

The workaround requires trapping for the resize event and forcing the page to reload. This sequence causes the page to flicker briefly between the jumbled page and the reloaded, properly proportioned page, but it’s better than nothing. The following script, taken from the HEAD section of a document, assumes you’ve included the utility code described earlier in this chapter that defines a global variable called isNav when the current browser is Navigator 4 or later:

function handleResize() {
    location.reload()
    return false
}
if (isNav) {
    window.captureEvents(Event.RESIZE)
    window.onresize = handleResize
}

Internet Explorer 4 handles window resizing more gracefully, automatically reflowing the content without the need for intervention.

Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.