Q:

KitKat WebView incorrectly reports pageYOffset

On Android, within a webview, we're having an issue in which the window.pageYOffset property intermittently returning 0 incorrectly.
It also returns 0 when it should, as in, the top of the page.
Here's a JSBin showing what we have so far (open the console):
jsbin
Here's the code we're using:
jsbin
And here's a screenshot of the console.log as the page is being scrolled.

Our environment is Android KitKat, using a webview within an application, that the chrome developer tools is reporting as version (33.0.0.0).
Also worth mentioning that we if we load the page within chrome 37 on KitKat it functions as expected, and does not intermittently report 0.

A:

So here's a solution where you'll have to cache the offset value on scroll, and when the WebView intermittently returns 0 for window.pageYOffset, use the previously cached position.
Here's a JS Bin that works in the Android WebView.
Rather nasty regarding performance I know, but implementing an interval or timeout like this will also help.

