How to resize the browser window to full screen size when it loads in Internet Explorer

Article translations Article translations
Article ID: 287171 - View products that this article applies to.
This article was previously published under Q287171
Expand all | Collapse all


This article describes how to use JavaScript to automatically resize the browser window to the maximum height and width when the window is loaded within a Web page.


  1. In Page view of Microsoft FrontPage, click the HTML tab.
  2. Insert the following JavaScript just below the <HEAD> tag:
    <script language="JavaScript">
    window.onload = maxWindow;
    function maxWindow()
    if (document.all)
    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;
When the page that has the JavaScript is loaded, the browser window is maximized. Notice that the window is not fully maximized to fill the whole screen, and you can drag the mouse to resize the window. In addition, the maximize button is still available if you want to fill up the screen with the window. The preceding code resizes the current browser window to the maximum height and width that are available for the screen resolution and allows the border of the window to still be visible.


For additional information, visit the following Microsoft Developer Network (MSDN) Web site:

Web development


Article ID: 287171 - Last Review: June 19, 2012 - Revision: 4.0
  • Microsoft Internet Explorer 4.01 Service Pack 1
kbdhtml kbhowto kbscript KB287171
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.

Give Feedback


Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from