Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mobile Safari - viewport device-height not working as expected

I have a web app that I'm trying to run on an iPad 3. When I pull it up, the app is allowing vertical scroll when it shouldn't be. I've gone through the same process with other web apps without any issues, and am not sure what I am missing this time around.

Inside head element of my html, I have the following meta tags:

    <meta name="format-detection" content="telephone=no">
    <meta name="viewport" content="user-scalable=no, initial-scale=1, minimum-scale=1, maximum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi">
    <meta name="apple-mobile-web-app-capable" content="yes">

In my CSS:

    html, body { width: 100%; height: 100%; overflow: hidden; }

Trying to debug this issue in weinre and discovered that the document width and height are somehow equal, when height show be much smaller (in landscape).

    $(document).width();  // returns 1024
    $(document).height(); // returns 1024

Searching around SO, other answers have been to supply a viewport meta tag, which I'm already doing. Can someone point me to a solution here?

like image 530
Danny Avatar asked Dec 21 '25 04:12

Danny


1 Answers

It looks to me like you are using too many properties of viewport that might conflict with each other. Apple suggests to set few of them or one and test in isolation as others are automatically inferred.

Bootstrap in its basic template recommends to set only width and initial-scale.

I would be very careful with maximum-scale or anything restricting user's zooming as it forces the user into uncomfortably small (or large) text.

like image 69
Dmitri Zaitsev Avatar answered Dec 23 '25 18:12

Dmitri Zaitsev