|
|
||||||||||||
Maximizing a windowQuestion: How do I maximize a window?
Answer:
To maximize the browser window, your code should determine
the available screen size and then resize
the window to the user's screen size.
Note that there is no reliable way to determine the screen size in version 3 of both
major browsers (except for calling Java from Navigator 3.x).
Therefore, the following sample function
function maximizeWindow() {
if (parseInt(navigator.appVersion)>3) {
if (navigator.appName=="Netscape") {
if (top.screenX>0 || top.screenY>0) top.moveTo(0,0);
if (top.outerWidth < screen.availWidth)
top.outerWidth=screen.availWidth;
if (top.outerHeight < screen.availHeight)
top.outerHeight=screen.availHeight;
}
else {
top.moveTo(-4,-4);
top.resizeTo(screen.availWidth+8,screen.availHeight+8);
}
}
}
A couple of remarks:
1. In Windows, maximizing a window is equivalent to
2. Note also that JavaScript code cannot change the look of the maximize button (the second button in the top right corner).
JavaScripter.net.
Copyright
© 1999-2006, Alexei Kourbatov
|
||||||||||||