Window.innerHeight issue on android 2.3.5

First: Yes, I did google, I even got into the dark side of google search results.

Using Android Nexus S and default browsers on Android 2.3.5 window.innerHeight reports wrong value.

Reports the value of window.height (which should be 452) minus the keyboard height (207). This happens after a reboot (touching the address bar and pressing "go").

This example code is returning incorrect results:

$(function() {
    alert(window.innerHeight); // 245

    setTimeout(function() {
        alert(window.innerHeight); // 245
    }, 1000);
});

      

The following results return incorrect results:

$(body).height(); // (way) too high
screen.height; // 245
window.outerHeight; // 600+
document.body.offsetHeight; //646
screen.height / window.devicePixelRatio - window.screenTop; //125.xxx;

      

The window.onResize event doesn't fire, however rotating it at the same time fixes the height issue (but I can't tell my clients do that).

I messed up the viewport a bit. This is my current one:

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

      

I hope I missed the niche corner on the internet where the holy grail of android and window.innerHeight is available (and free to use;)

So, if you know of any solution or something that has fixed something like this in the past, please share :)

+3


source to share


1 answer


I see the same problem as you and the fix is ​​exactly the same - the rotation is twofold.



Also, wait for another version of Android to appear.

0


source







All Articles