window.innerHeight 在 iOS 11 中返回错误值

window.innerHeight returning wrong value in iOS 11

我在最新版本的 cordova (8) 和 cordova-ios (4.5.4) 上有一个 cordova iOS 应用程序 运行。我最近开始考虑更新应用程序以使用 WKWebView 而不是默认的 UIWebView,但我发现 iOS 11(在 iPad mini 上测试) webview 有时会报告错误的 innerHeight。

这是index.html中的相关代码:

<meta name="viewport" content="initial-scale=1, width=device-width, height=device-height, viewport-fit=cover">

<style type="text/css">
    html, body {
        height: 100%;
    }
</style>

这就是我尝试读取 属性 的方式(全部在 deviceready 处理程序之后):

document.addEventListener("deviceready", onDeviceReady, false);

function onDeviceReady() {
    var calcHeight = window.screen.height - window.innerHeight;
}

window.screen.height 总是评估为 1024,这很好,但 window.innerHeight 有时 returns 1004(这是预期值),但有时 returns 460 .

知道会发生什么吗?

提前致谢

您是否按照 Apple 的规范添加了视口标签?

http://developer.apple.com/library/safari/#documentation/appleapplications/reference/safariwebcontent/UsingtheViewport/UsingtheViewport.html