Results 1 to 3 of 3

Thread: window size

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Reading, UK
    Posts
    870

    window size

    Hi,
    hopefully a simple question!

    How do I set the size of the IE window when someone goes to my website?

    Thanks
    Nick

  2. #2
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    this can be done quite simply using JavaScript:

    Code:
    <script>
    // Coded by Kristopher <[email protected]>
    top.window.moveTo(20,20);
    if (document.all) {
      top.window.resizeTo(400,400);
    }
    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>
    This will set the browsers as follows: Left - 20, Top - 20, Width - 400, and Height - 400.

    This can be customized as follows:

    Code:
    <script>
    // Coded by Kristopher <[email protected]>
    
    wtop = 20; // replace with desired top
    wleft = 20; // replace with desired left
    wwidth = 400; // replace with desired width
    wheight = 400; // replace with desired height
    
    top.window.moveTo(wtop,wleft);
    if (document.all) {
      top.window.resizeTo(wwidth,wheight);
    }
    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>
    So if you ever want to change the dimensions, it's easy to customize.

    Hope this helps!
    My evil laugh has a squeak in it.

    kristopherwilson.com

  3. #3
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    I neglected to mention (incase you don't know) that this should go between the head tags:

    Code:
    <head>
    ...
    </head>
    My evil laugh has a squeak in it.

    kristopherwilson.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width