Should we use device-height in the Viewport tag?

OFF- TOPIC

Why do you see the need to include the height-device-height value in the viewport meta tag?

As far as I understand it height is inferred when you use the width=device-width but according to PPK the device-height implementation is broken and he advises not to use it.

So don’t use device-height, either. To be honest, even if it worked perfectly I wouldn’t see a reason to use it.

That article is a couple of years out of date now so I wondered if you have added the device-height for a specific reason (or use-case) as you never seem to add unnecessary stuff in your code at the best of times? :slight_smile:

3 Likes

< off-topic >

If my memory serves me well it was Jason M. Knight (aka Deathshadow),
who suggested, very politely I might add, that I use that form of meta tag.

As I am unable to test code on actual mobile devices, I have had to trust
that his suggestion was valid. :wonky:

I will contact him to see If my memory is correct and if so, his reason for it’s
inclusion. :winky:

< /off-topic >

coothead

1 Like

Thanks, that would be helpful as Jason was a fountain of knowledge and may have a ‘use-case’ that I am missing :slight_smile:

Hi there PaulOB,

< off-topic >

here is is the central theme of Deathshadow’s reply to me…

[quote][color=navy]…
The setting has ZERO negative impact on any unsupported device, but for MANY
Android tablets and phones - like my Icoo 7" Tab and Cubot Phone - if you do
not include it, the height passed to media queries is incorrect, as the LIE
height
is reported as width in landscape, instead of the proper device-height.

If it has ZERO negative impact on the majority of systems but fixes problems
on a great many, where’s the problem?

I’ve never seen it cause a problem, I have seen it’s omission cause problems
on systems I own.
…[/color][/quote]
In light of this latest information, I think that I will carry on using…

<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1">

…just to be sure. :winky:

< /off-topic >

coothead

4 Likes

Thanks @coothead I thought there may be some odd use-cases for adding it. :slight_smile:

That’s not quite true as a quick search reveals that there were problems in older versions of ios.

https://stackoverflow.com/questions/2581957/iphone-safari-does-not-auto-scale-back-down-on-portrait-landscape-portrait

It seems more a case of ‘swings and round-a-bouts’ to me and I will not be including the device-height because that is inferred from device-width as per the apple recommendations. (Indeed initial-scale=1 on its own should automatically infer device-width but as the viewport tag hasn’t really been standardised we are bound to run into odd case and user issues.)

I believe that in modern browsers there should be no negative impact in including device-height but why take the risk or clutter the code .:slight_smile:

2 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.