The onresize event

Netscape 4.x had a well-known bug where dynamic content wasn’t redrawn when a Web page was resized. Scripts 9.3 and 9.4 force the page to reload its contents to avoid this problem. Thankfully, Netscape versions 6 and later no longer suffer from this bug.

1.
window.onresize = resizeFix;
The event handler is attached to the window object and calls the resizeFix function.
2.
if (document.layers) {
We only want to do the following if the user has Netscape 4.x, and this is the simplest way to check that. The document.layers object only ever existed in this browser.
3.
var origWidth = window.innerWidth;
var origHeight = window.innerHeight;
If we’re in Netscape 4.x, we want to save the current height and width of the browser window ...

Get JavaScript and Ajax for the Web: Visual QuickStart Guide, Seventh Edition 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.