[HTML5] stage.stageHeight includes tab bar height on iPhone safari
Fixed with hackish way:
//on iPhone safari, tabBar height is not excluded from window.innerHeight
#if html5
untyped __js__("
function getH()
{
const topBar = document.getElementById('topBarContainer')
let topOffset = topBar ? (window.innerHeight - Number(getComputedStyle(topBar).height.slice(0, -2))) / window.innerHeight : 1
function getComputedStyle(node) {
return node.nodeType === 1 ? node.ownerDocument.defaultView.getComputedStyle(node, null) : {};
}
return window.innerHeight - topOffset;
}
");
#end
var height:Float = #if html5 untyped getH() #else stage.stageHeight #end;
May be there is a nicer workaround?
I believe stage.stageHeight
is based upon the size of the parent DIV element on the site, so perhaps there is a way to change the CSS of the index HTML page so that it shrinks below the top bar?