I am attaching a listener to the orientationchange event:
window.addEventListener(\'orientationchange\', function () { console.log(window.innerHeight); }
I also faced the same problem. So I ended up using:
window.onresize = function(){ getHeight(); }