how to get exact height of body of the webbrowser window?

前端 未结 3 2031
时光说笑
时光说笑 2020-12-17 02:54

I want to get exact height of the body of webbrowser window. I tried innerHeight, clientHeight all other solutions which I get while googling. but none of them give exact he

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-17 03:34

    Have you tried using:

    window.outerHeight (this is for IE9 and other modern browser's height)
    

    For Internet Explorer with backward-compatibility mode, use

    document.body.offsetHeight 
    

    And also, Internet Explorer (standards mode, document.compatMode=='CSS1Compat'):

    document.documentElement.offsetHeight 
    

    Have a look at the following for more information:

    • http://www.javascripter.net/faq/browserw.htm
    • http://everyday-tech.blogspot.com.au/2009/07/js-calculate-browser-window-height.html

提交回复
热议问题