iOS 7 iPad Safari Landscape innerHeight/outerHeight layout issue

后端 未结 13 959

We\'re seeing issues with a web app that has a height of 100% on Safari in iOS 7. It appears that the window.innerHeight (672px) doesn\'t match window.outerHeight (692px), b

13条回答
  •  时光说笑
    2020-11-27 11:02

    Samuel's answer is the best although it breaks if a user adds the page to their home screen (home screen pages don't exhibit the bug). Check the innerHeight before adding the class like so:

    if (navigator.userAgent.match(/iPad;.*CPU.*OS 7_\d/i)) {
        if(window.innerHeight==672){
            $('html').addClass('ipad ios7');
        }
    }
    

    Note that the bug also does not exhibit under webview.

提交回复
热议问题