Is Safari iOS9 the wrong value for window.innerHeight?

Here is the meta tag of my view:

<meta name="viewport" content="user-scalable=no, initial-scale = 1, minimum-scale = 1, maximum-scale = 1, width=device-width"> 

In Safari iOS 8, window.innerHeight and $(window).height() both return the same value: 928 on the iPad.

But in Safari iOS 9, window.innerHeight and $(window).height() return different values: respectively 1461 and 559 on the iPhone 6s, running iOS 9.0 or 1154 and 905 on the iPad mini running iOS 9.1.

Is this a bug in Safari or is it intended? Where did this 1461 come from on my iPhone? Should I use $(window).height() (which returns the value I want) instead of window.innerHeight ?

+8
javascript jquery safari ios ios9
source share
3 answers

Yes, I experienced the same behavior ...

Using $(window).height() seems to work, but I think it's better to change the meta tag.

See here

+5
source share
 <meta name="viewport" content="width=device-width initial-scale=1 shrink-to-fit=no"> 

adding "shrink-to-fit = no" to the viewport meta tag fixed the wrong window.innerHeight value for resizing for me -

https://forums.developer.apple.com/thread/13510

+3
source share

Try changing your meta tag to.

 <meta name="viewport" content="initial-scale=1.0001, minimum-scale=1.0001, maximum-scale=1.0001, user-scalable=no"/> 
+2
source share

All Articles