Skip to content Skip to sidebar Skip to footer

Get Window Height On Mobile Devices (especially Iphones) Without Using Jquery

All the answers on SO for fetching the device's height seem based on jQuery. We need something in pure JavaScript before the jQuery code loads.

Solution 1:

document.documentElement.clientHeight

There are a number of other methods, too: http://responsejs.com/labs/dimensions/

Solution 2:

May be a little late, but use window.screen.height

Solution 3:

In most cases, $(window).height(); does the job. However, on iOS, it gives wrong results because of the toolbars, same as $(window).outerHeight();. The right value to use is window.outerHeight.

Try this :

(typeofwindow.outerHeight != 'undefined')?Math.max(window.outerHeight, $(window).height()):$(window).height()

Post a Comment for "Get Window Height On Mobile Devices (especially Iphones) Without Using Jquery"