Home | All Questions | alt.html FAQ > Client-side Windows Scripting

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:

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>

Recommended Resources

Discussion

Related Questions