This series of articles mainly concentrates on working with browser windows and their sub-windows in JavaScript. You can reuse these scripts to inject into server side controls easily (especially in .NET and Java).
This concept is a peculiar case. Can we really maximize a browser window using JavaScript? To which my answer is NO. There exists no direct procedure to maximize a browser window dynamically using JavaScript at all. The best indirect way to achieve the same is to resize the window so that it fits the entire screen!
Let us consider the following function I used in the above code:
function MaximizeWindow() { var offset = 4; //needs to change accordingly with browsers window.moveTo(-offset, -offset); window.resizeTo(screen.availWidth + (2 * offset), screen.availHeight + (2 * offset)); }
The above is a simple function which uses an indirect way of maximizing a browser window. I used the “offset” especially to push the border of the browser window a further four pixels to the left and top (mimicking the maximization). But please be aware that some browsers work with the “offset” value as simply zero. I leave it to you.
We can use the “screen” object to determine the width and height of a desktop screen. Based the values I receive from “availWidth” and “availHeight” from the “screen” object, I resize the browser window accordingly.