on calling refresh during onResize

From time to time I have come across web sites that do something like this:

<body onResize=“document.execCommand('Refresh')”> ... </body>

Generally this is done so the page can redo all of the necessary layout calculations for the new size it is being constrained to. This leads to a lot of useless page reloads as the user drags the window around. Really complex pages could have quite a perf impact on the machine. 

Of course with XP SP2 there is an additional concern: if the page automatically launches a download, or tries to install an ActiveX control, or automatically launches a pop-up window the information bar will appear at the top of the page. To make room for the information bar, the mshtml window will be resized. With the above HTML, the appearance of the information bar will cause the page to reload. This will start the cycle all over again, leading to infinite page reloading. It is better to have layout methods that can be called directly, instead of being lazy and just refreshing the page. 

Another good practice is to not assume that window.open() will always succeed, but instead check the return value for null before using it. If it returns null, your script should handle it. There has always been the possiblity of failure while creating a new window.

Doc links: execCommand onResize window.open