Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meta Viewport tag currently in use is broken on iOS #1398

Closed
wants to merge 1 commit into from

Conversation

Snugug
Copy link
Contributor

@Snugug Snugug commented Jun 30, 2013

Using only width=device-width causes iOS to fix the width and not update on orientation change. Including initial-scale=1.0 solves this issue. Take a look at the viewport test I've made.

Using only `width=device-width` causes iOS to fix the width and not update on orientation change. Including `initial-scale=1.0` solves this issue. Take a look at the [viewport test](http://snugug.github.io/viewport-test/) I've made.
@@ -16,7 +16,7 @@
<meta name="description" content="">

<!-- Mobile viewport optimized: h5bp.com/viewport -->
<meta name="viewport" content="width=device-width">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

This comment was marked as abuse.

This comment was marked as abuse.

@necolas
Copy link
Member

necolas commented Jun 30, 2013

Related #1099 (comment)

@necolas
Copy link
Member

necolas commented Jun 30, 2013

Fixed by ff37dba. Thanks

@necolas necolas closed this Jun 30, 2013
@Snugug
Copy link
Contributor Author

Snugug commented Jun 30, 2013

Awesome, thanks!

@jelmerdemaat
Copy link

I searched through the issues and found this one before opening a new one regarding initial-scale=1: see http://www.quirksmode.org/blog/archives/2013/10/initialscale1_m.html

I propose to change the meta tag to not include width=device-width at all.

One common problem on iOS is that, when you use a meta viewport tag with width=device-width, the page doesn’t react to an orientation change. On the iPhone the page becomes 320px wide and on the iPad 768px, regardless of whether you’re in portrait or in landscape mode.

As advised on Quirksmode by @pp-koch:

Note: do not use width=device-width, or iOS will revert back to its usual behaviour.

Is this a wanted change?

@alrra
Copy link
Member

alrra commented Oct 16, 2013

Is this a wanted change?

@jelmerdemaat we should discuss this. Can you open a new issue and maybe even provide some test pages ? Thanks!

alrra added a commit to h5bp/html5boilerplate.com that referenced this pull request Oct 16, 2013
@jelmerdemaat
Copy link

Can you open a new issue and maybe even provide some test pages ? Thanks!

I can certainly open a new issue, later today. I have no experience with making test pages but I will certainly try and provide my examples with the issue!

@alrra
Copy link
Member

alrra commented Oct 16, 2013

I can certainly open a new issue, later today. I have no experience with making test pages but I will certainly try and provide my examples with the issue!

Great, thanks!

@roblarsen
Copy link
Member

(Randomly) in looking at this issue I discovered that @pp-koch (who I'm sure has a test page or two) is on Github and has a total of 2 followers.

@necolas
Copy link
Member

necolas commented Oct 16, 2013

I thought this bug was patched in iOS6, which is why this was reintroduced in both this and the mobile BP project

@jelmerdemaat
Copy link

I have not made a new issue yet because I have not yet been able to reproduce the problem. @Snugug already made a demo page which indeed seems buggy for me, but at the moment I am only able to test with iOS 5.1.1. Can anyone confirm the behavior described in the Quirksmode post for iOS6 and/or iOS7 using the provided demo?

@jonathantneal
Copy link
Member

screenshot

Other pages are the same, except No Viewport Tag which displays the zoomed-out green as expected.

@jelmerdemaat
Copy link

And when you rotate the device to landscape? As I understand the problem would occur when the orientation changes, the layout would stick to 320px wide.

@jonathantneal
Copy link
Member

@jelmerdemaat, from the test you mentioned:

[Device]: [reported width as portrait, color] => [reported width as landscape, color] => [reported width as portrait, color]

No Viewport Tag: 980px, green => 980px, green => 980px, green
Device Width + Initial Scale: 320px, red => 568px, green, => 320px, red
Device Width Only: 320px, red => 568px, red => 181px, red
Initial Scale Only: 320px, red => 568px, green => 320px, red

Device Width Only zooms, misrepresents the width, and rather humorously misrepresents the width on return to portrait.

screenshot-2

@alrra
Copy link
Member

alrra commented Oct 17, 2013

from: http://www.quirksmode.org/blog/archives/2013/10/more_about_scal.html

combining width=device-width,initial-scale=1 does work.

@mathiasbynens
Copy link
Member

Classic trolling by @ppk :)

@jelmerdemaat
Copy link

Oh... well... hooray! :) Thanks guys 👍

alrra added a commit to h5bp/html5boilerplate.com-mobile that referenced this pull request Dec 8, 2013
rlovtangen added a commit to rlovtangen/grails-profile-repository that referenced this pull request Feb 18, 2015
jameskleeh pushed a commit to grails-profiles/web that referenced this pull request Jul 5, 2016
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants