Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Posts
    553
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Got the Shakes on Browser Window Maximize?

    I used the dynamic drive script below in each page of a site to maximize the browser window on load, but I notice it creates a shake as I move from page to page within the site (the window is already maximized, and I guess each time the maximize function is triggered moving from one page to the next the attempt to maximize causes the 'shake'). If I only maiximize the main page, will all the other pages maximize anyway? Is there a way to accurately determine if the browser is already maximized and not re-maximize it?

    G

    <script language="JavaScript1.2">
    <!--

    /*
    Auto Maximize Window Script- By Nick Lowe (nicklowe@ukonline.co.uk)
    For full source code, 100's more free DHTML scripts, and Terms Of Use
    Visit http://www.dynamicdrive.com
    */

    top.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>

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It doesn’t actually maximize the browser, it sizes it by using the screen size.

    I think once it has been resized it will stay that way until the user changes it. It will help if you put it on your index page only but they could enter your site by another page.

    I think you need a method of passing a variable between pages. Maybe cookies or a hidden frame?

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Posts
    553
    Thanks
    0
    Thanked 0 Times in 0 Posts
    you need a method of passing a variable between pages. Maybe cookies or a hidden frame?
    Graeme,

    I would rather simplify than complicate - cookies or frames are overkill I think for what I am trying to manage. I wonder if I can inspect the settings that the script alters at the top of the script and then bypass the script logic if the settings indicate the window is already max. Is it possible to detect if the window is at 0,0 and width and height are equal to available width and height?

    G

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes that's a better idea.

    I've never done anything with screen position but it sounds like it would work

    Something like:

    if ((screen x ==0) && (screen y ==0)) {
    } else { // do nothing
    maximize
    }

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Posts
    553
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks... I've tended to want to maximize because I have large images in the pages and want them to be fully visible. But the more I think about it, the more I think the browser should be left as the viewer has sized his/her other windows. Especially since I am introducing that shake thing every time I resize it.

    G

  • #6
    Regular Coder
    Join Date
    Jun 2002
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts
    How about going in the opposite direction. You could size the images to fit the available window.

  • #7
    Regular Coder
    Join Date
    Jun 2002
    Posts
    553
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Graeme,

    Thanks for the suggestion. I currently already load one of three different sized images based on screen resolution, for 640, 800 and 1024 widths. This gives me 3 standard sizes that cover most viewers. I found that resizing images (i.e. by way of the width and height attributes of the image tag) caused some subtle problems in the image presentation that I won't bore you with here. Letting the size flow against the available window means you may have the image at an absurdly small size, and means that you have much less ability to shape the way the text and other elements fall around the image, and also means that you must either adjust if the viewer then resizes or leave the image inappropriately sized. If the viewer chooses to keep his browser window small, then he will see all web sites in the same limited manner, and so mine will be consistent with that. Why should I dictate how his browser is to be sized? If he sizes the browser for optimium viewing of most sites, then he will also see mine optimally. At least that was the conclusion I reached.

    G
    Last edited by gorilla1; 08-05-2002 at 03:31 AM.

  • #8
    Regular Coder
    Join Date
    Jun 2002
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I haven't done this yet but I don't see why it wouldn't work.

    If window sizes are used then the dimensions are written to the page, you could write an if else statement and use defined sizes when the window is at the extremes.

    I’m only thinking in the context of stand alone images. I have no need for text flow but it might correct that also.


  •  

    Posting Permissions

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