我有一个科尔多瓦iOS应用程序运行在最新版本的科尔多瓦(8)和科尔多瓦-ios (4.5.4)的日期。我最近开始考虑更新应用程序以使用WKWebView
,而不是默认的UIWebView
,但我发现在iOS 11 (在iPad mini上测试)中,网页视图有时会报告错误的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
有时返回1004 (这是预期值),但有时返回460。
你知道可能会发生什么吗?
提前感谢
发布于 2018-06-05 07:58:33
https://stackoverflow.com/questions/50690191
复制相似问题