Determine the current window height/width?

Discussion in 'Javascript' started by Dave Hammond, Apr 15, 2005.

  1. Dave Hammond

    Dave Hammond Guest

    You'd think this would be a basic part of the window object (and
    perhaps it is and I'm just being dense), but I can't find any reference
    in the IE window object documentation to a property which returns the
    current window height/width. I can't check Mozilla, as the site is
    currently unresponsive, but i don't recall there being any mention of
    height/width properties in the Mozilla window object docs either.
    Seems like if the object can tell me what its current top/left corner
    is, then it should be able to tell me what its size is. Am I missing
    something?

    As for the application, I'd like to be able to resize a window, run a
    script, then restore the window to its original size when the script
    completes.

    Thanks in advance, and if I'm being blind or dense, please be gentle
    with the flames.

    -Dave H.
    Dave Hammond, Apr 15, 2005
    #1
    1. Advertising

  2. Dave Hammond

    Dave Hammond Guest

    Well, I was able to get on mozilla.org and found the innerHeight and
    innerWidth properties. A quick test shows they don't work in IE, so
    I'm still stuck for a solution and would still appreciate any
    recommendations (other than 'switch to Firefox' which is unfortunately
    not an option ;)
    Dave Hammond, Apr 15, 2005
    #2
    1. Advertising

  3. Dave Hammond

    DU Guest

    Dave Hammond wrote:

    > You'd think this would be a basic part of the window object (and
    > perhaps it is and I'm just being dense), but I can't find any reference
    > in the IE window object documentation to a property which returns the
    > current window height/width.


    The content area (window viewport) only or the whole window? Anyway,
    why would you need to determine the window dimensions of your webpage
    visitor?

    I can't check Mozilla, as the site is
    > currently unresponsive, but i don't recall there being any mention of
    > height/width properties in the Mozilla window object docs either.
    > Seems like if the object can tell me what its current top/left corner
    > is, then it should be able to tell me what its size is. Am I missing
    > something?
    >
    > As for the application, I'd like to be able to resize a window, run a
    > script,


    What does your script need to do?

    then restore the window to its original size when the script
    > completes.
    >


    Most browser users now disable, turn off script abilities to resize and
    move windows in a majority of browsers. Why would you need to resize the
    browser window back and forth like that to begin with?

    > Thanks in advance, and if I'm being blind or dense, please be gentle
    > with the flames.
    >
    > -Dave H.
    >


    DU
    --
    The site said to use Internet Explorer 5 or better... so I switched to
    Mozilla 1.7.7 :)
    DU, Apr 17, 2005
    #3
  4. Dave Hammond

    Fred Oz Guest

    Dave Hammond wrote:
    > You'd think this would be a basic part of the window object (and
    > perhaps it is and I'm just being dense), but I can't find any reference
    > in the IE window object documentation to a property which returns the
    > current window height/width. I can't check Mozilla, as the site is
    > currently unresponsive, but i don't recall there being any mention of
    > height/width properties in the Mozilla window object docs either.
    > Seems like if the object can tell me what its current top/left corner
    > is, then it should be able to tell me what its size is. Am I missing
    > something?
    >
    > As for the application, I'd like to be able to resize a window, run a
    > script, then restore the window to its original size when the script
    > completes.
    >
    > Thanks in advance, and if I'm being blind or dense, please be gentle
    > with the flames.


    Please be gentle with browser windows. If this is for an intranet
    and there are valid reasons for re-sizing windows, fine. But playing
    with a user's windows on the internet is considered rude and
    offensive - but if you want to annoy your visitors, that's up to you.

    Anyhow, whatever you need to know can probably be found here:

    <URL:http://www.quirksmode.org/>

    Follow the 'viewport' and "Browser compatibility" links.


    >
    > -Dave H.
    >



    --
    Fred
    Fred Oz, Apr 17, 2005
    #4
  5. Dave Hammond

    Dave Hammond Guest

    Thanks, Fred. It is, in fact, for a private intranet-based application
    which opens multiple windows for various components of the application
    (menu, main program, messages, etc). My reason for wanting to know the
    original window size is so that upon logout from the application,
    rather than be rude and leave the user with a resized window, I can
    restore their original window dimensions and attributes.

    -Dave H.
    Dave Hammond, Apr 18, 2005
    #5
  6. Dave Hammond

    Dave Hammond Guest

    Hi DU,

    As for my reasons for wanting to resize and move windows, please see my
    response to Fred Oz. As for your opinion that most browser users now
    disable script abilities to resize, I would respectfully disagree. The
    vast majority of browser users wouldn't begin to know how to do that.
    Sure, those who live and breath the internet know what they're doing,
    but those who just use it as a means to an end (information,
    entertainment, productivity, etc) still use the IE which came installed
    on their PCs, and still consider most of the Tools menu options
    (including preferences) to be places better left unexplored. Perhaps
    sad, but undeniably true.

    -Dave H.
    Dave Hammond, Apr 18, 2005
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Leo
    Replies:
    2
    Views:
    494
  2. Lois
    Replies:
    1
    Views:
    3,215
    Ryan Stewart
    Dec 27, 2004
  3. cera
    Replies:
    1
    Views:
    1,260
    Neredbojias
    Aug 18, 2007
  4. Bernd Meier
    Replies:
    6
    Views:
    506
    GTalbot
    Jan 14, 2008
  5. magix

    determine images width and height

    magix, Mar 20, 2008, in forum: ASP General
    Replies:
    1
    Views:
    121
    Bob Barrows [MVP]
    Mar 20, 2008
Loading...

Share This Page