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 2 of 2
  1. #1
    New Coder
    Join Date
    Oct 2007
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Browser display size

    Hi!

    My question is: Is it possible to get the display size (especially height) of the browser window (with javascript or other way)?

    I know you can get the screen resolution, but in a borwser you can have toolbars, multiple sheets, etc. So I am talking about the 'clean' size of the browser window in pixels. (For some reason percentage way is no good for me.)

    I guess the answer is no, but maybe i'm wrong.

    Thanks

  • #2
    Regular Coder mjlorbet's Avatar
    Join Date
    Jan 2008
    Location
    Milwaukee, WI
    Posts
    724
    Thanks
    8
    Thanked 96 Times in 95 Posts
    if you're looking for the height of the displayable content (not the browser window itself but the area for html layout) you can use

    Code:
     
    var height = document.documentElement.clientHeight || document.clientHeight || window.innerHeight || 0;
    same for width (just change "height" to "width" in each element)
    should probably verify each of these elements as well, i'm pretty sure but this is just off the top of my head, a quick google on each term will give you the results you need
    -Mike
    "Want me to precludify him, like some kind of dispatcherator?... Can do!" -Bender


  •  

    Posting Permissions

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