How do I maximise the browser window?
A word of warning: Many users do not want a browser that is resized to fill the available screen space on their systems.
For example (and it is an extreme example, but there are other people with more common configurations that wouldn't like forced maximisation either), I run at 2624x1200, and a browser window attempting to fill that space would:
- Look stupidly big
- Be split with a large gap where one monitor ends and the next begins
- Have a large section missing (I have a large screen and a small one, the result is some dead space)
- Cover up all the other applications that I run at the same time.
If you plan to attempt to fake a maximise (because the example code doesn't maximise windows it tries to make them fill the screen which is something different) then be very very careful about who you do it to.
In a window that your website owns, you can use the following:
<script type="text/javascript"> window.moveTo(0,0); if (document.all) { top.window.resizeTo( screen.availWidth, screen.availHeight); } else if (document.layers || document.getElementById) { if (top.window.outerHeight < screen.availHeight || top.window.outerWidth < screen.availWidth){ top.window.outerHeight = screen.availHeight; top.window.outerWidth = screen.availWidth; } } </script>