How do I use Javascript to detect the screen size y and x if the screen is maximized?

Discussion in 'JavaScript' started by Imozeb, May 16, 2010.

  1. #1
    I've been trying document.body.clientHeight and document.body.clientWidth but I'm running into errors.

    1. clientWidth returns my screen with but clientHeight is returning a '0' Why is this?

    2. If I resize my browser window clientWidth returns a smaller number. How would I make it so it returns the width of the entire users screen (include the parts that are hidden because the window is smaller?)

    Thanks.
     
    Imozeb, May 16, 2010 IP
  2. anands

    anands Well-Known Member

    Messages:
    436
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    120
    #2
    I think you are trying to get screen resolution here.

    Did you try screen.width and screen.height methods?

    You can also try window.outerWidth and window.outerHeight.
     
    anands, May 18, 2010 IP
  3. Imozeb

    Imozeb Peon

    Messages:
    666
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks. It worked.

    Do you know how to check a users connection speed with javascript without acctually have to download something?
     
    Imozeb, May 18, 2010 IP