Welcome, Guest
  • Author Topic: current browser size?  (Read 2960 times)

    Musicman

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 2685
      • View Profile
      • Email
    current browser size?
    « on: 08/14/02, 17:21 »
    Hi,

    do you know about a reliable way to determine the current browser size for IE? - I cannot really use 100% for movie dimensions but rather have to derive them from the total browser area.
    I do not want to force the user to fullscreen (it is sort of impolite)
    In Netscape I can use window.innerWidth, and in some older version of IE I could use document.body.clientwidth

    Musicman

    Flash-db

    • Administrator
    • Systems Administrator
    • *****
    • Posts: 1876
      • View Profile
      • Flash-db.com
    Re:current browser size?
    « Reply #1 on: 08/15/02, 02:04 »
    Hey Musicman,

    I had the same problem a while ago - the tough part is actually sizing the movie.  The only way I was able to do it was with a Refresh.  Basically capture the screen size when the user first got to the site, set a cookie with the width and height, then use header(Location...) right after.  It was fast enough that the user never knew the page was actually refreshed once.  One problem with that was that Cookies had to be enabled.

    It looked something like this:

    Code: [Select]

    $WGet = $HTTP_GET_VARS[W];
    $HGet = $HTTP_GET_VARS[H];

    // $W and $H where from a Cookie

    if ($W && $H) {

       if ($WGet && $HGet) {
          setcookie ("W", $W, time()+30240000, "/");
          setcookie ("H", $H, time()+30240000, "/");

       header("Location: [url=http://www.flash-db.com/"]http://www.flash-db.com/"[/url]);
       exit;
       }

                 ############# Determine SWF Size
                  if ($W > '1024') {
                            $width = ($W*940) / 1024;
                            $height = ($H*620) / 768;
                  } else {
                             $width = 940;
                             $height = 620;
                  }
    // HTML... Embed movie with $width and $height size


    } else {

    print "<HTML><HEAD><SCRIPT LANGUAGE=\"javascript\">top.location=\"index.php?W=\"+screen.width+\"&H=\"+screen.height;</script>";

    }




    Well I have no idea if that was helpful or not.  Basically the last line was the most important - use JS  top.location then refresh to the same page with the browser width and height attached.  The use those values to size the SWF movie - and set a cookie so you do not have to do it each time.


    It worked for all browsers.  Just an idea.

    Flash-DB

    Musicman

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 2685
      • View Profile
      • Email
    Re:current browser size?
    « Reply #2 on: 08/15/02, 03:00 »
    Hi,

    thanks a lot - but I just do not want to use the _screen_ size, rather the current browser _window_
    I get mad at sites resizing my browser, so I do not want to inflict that on others

    Muicman

    Flash-db

    • Administrator
    • Systems Administrator
    • *****
    • Posts: 1876
      • View Profile
      • Flash-db.com
    Re:current browser size?
    « Reply #3 on: 08/15/02, 03:12 »
    Ok so your just looking for the current size of the browser and not the available screen height and width.  I'm not sure what you can do - gave it my best shot though.  Just checked my JS Object table guide and couldn't find anything for IE - as you mentioned innerHeight and innerWidth work for Netscape 4+ but can't think of anything that would be similiar for IE.

    The screen.width does not resize the persons browser only returns the available screen size - but I get your point in that not everyone will have their browser window open to it's fullest extent.  It seems like this is a fairly common problem - but I've never seen any good solutions to it.  Sorry I can't help any more with that.
    Flash-DB

    dateye

    • Guest
    Re:current browser size?
    « Reply #4 on: 08/16/02, 10:30 »
    i need to create a website for somebody and i need to know how
    www.asianwarez.com created that resizing in the menu they have on the left side.
    does any of you understand how he did it? if so then plz send me a reply

    Maybe it's very simple but i just don't know how :(
    SUPER thx in advance :)

    Musicman

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 2685
      • View Profile
      • Email
    Re:current browser size?
    « Reply #5 on: 08/16/02, 12:28 »
    Hi,

    it seems to be just a separate frame with

    width=100% height=100% scale=exactfit

    Musicman