6

After upgrading my iOS devices to iOS 8.3 I noticed some weird behavior with the meta viewport initial scale property. If I set the initial scale under 1.0 and rotate my device while I am on a webpage, the whole content will get progressively smaller and eventually the browser will crash.

I noticed that the amount of how much smaller the content gets with each orientation change is linked to how much you set the initial scale. For example if I set it to 0.9, the content will get 10% smaller every time. If I set it to 0.6, the content will get 40% smaller every time.

Due to the nature of this bug, it cannot be put or experienced on jsfiddle. Instead I will paste the code right here so you can test it yourself somewhere:

<!doctype html>
<html>
    <head>
        <title>initial scale under 1.0</title>
        <meta name="viewport" content="width=device-width, initial-scale=0.7, user-scalable=0" />
    </head>
    <body>
        <div id = "wrapper">
            <h1>Hello, run this page on iOS 8.3 device and change the orientation multiple times to make this text go smaller and eventually crash the browser!</h1>
        </div>
    </body>
</html>

You can compare that broken example with a working one, which has the initial-scale set to 1.0:

<!doctype html>
<html>
    <head>
        <title>initial scale 1.0</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0" />
    </head>
    <body>
        <div id = "wrapper">
            <h1>This text will not get smaller nor will the browser crash when you rotate your device multiple times!</h1>
        </div>
    </body>
</html>

Before upgrading to iOS 8.3 the device rotation worked just fine. The layout neither get zoomed out or in nor did the browser crash after multiple orientation changes.

Is there a way to fix this issue?

Durai Amuthan.H
  • 31,670
  • 10
  • 160
  • 241
Swiffy
  • 4,401
  • 2
  • 23
  • 49
  • Similar problem: http://stackoverflow.com/questions/29737908/ios-8-3-meta-viewport-with-fixed-width-results-in-weird-content-scaling-on-ori – Swiffy Apr 20 '15 at 11:12
  • 1
    `` Can you try and let me know – Durai Amuthan.H Apr 23 '15 at 20:05
  • I just checked the code in iOS 8.3 Safari (iPhone 6+); no issues - changed the orientation 50 times. What device are you using? As @Duraiamuthan.H suggested, add the maximum and minimum scale (I would say to 0.7 not, so the scale doesn't change from 0.7). My guess for this problem is that, the iOS rendering tries to get 60% of the current scale every time. Sounds like a very weird bug to me. Try to close Safari and reopen it. If that doesn't fix the issue, report a bug to Apple (or you have a broken iOS install) – Gasim Apr 25 '15 at 10:00
  • @Piwwoli - It seems like Bug to me as well.Because the issue happens in particular version of yours.I couldn't reproduce it and you are also not able to reproduce this issue in your 8.3 so we can assume apple has released a patch for this. – Durai Amuthan.H Apr 25 '15 at 17:17
  • @Duraiamuthan.H I am not able to reproduce the bug with the examples I gave anymore. However, it still happens with some other sites that I have made, which have the same exact meta viewport tag. I noticed a new thing related to this issue: If I reproduce the bug in some site that still somewhy reproduces it and then navigate to some other page, like Google, does not matter what site - the scale stays and the site I navigated to is also zoomed out in a weird way. After refresh it sometimes gets fixed and sometimes I need to restart Safari. Oh and I get the same bug with 8.3 iPad and 8.3 iPhone – Swiffy Apr 27 '15 at 07:23
  • @Piwwoli - Is your site mobile responsive site ? do you use any kind of framework like bootstrap ? can you give me your site ulr that has this problem so that I can do a quick analysis and get back 2 u. – Durai Amuthan.H Apr 27 '15 at 07:30
  • @Duraiamuthan.H In one of these sites I use jQuery mobile, but they all should be responsive either way. These sites are all in a closed network, for which even I do not have vpn access to. I'll see if I can pinpoint the problem better. – Swiffy Apr 27 '15 at 08:17
  • @Piwwoli - jQuery mobile is meant to be responsive to various screen sizes. – Durai Amuthan.H Apr 27 '15 at 08:23
  • @Duraiamuthan.H Exactly, and it is. There is just something going on with the iOS 8.3 Safari. Oh, right, it only happens with the Safari browser. Google Chrome on iOS 8.3 is fine. – Swiffy Apr 27 '15 at 08:27
  • @Piwwoli - some versions of jquery mobile is incompatible with some of versions iOS leading to unwanted scaling.see this answer http://stackoverflow.com/a/6457261/730807.It is always best to have latest version of jquery mobile in your project ..because they will add the fixes that they encounter in the newer versions.you can see the bug filed here https://forum.jquery.com/topic/what-viewport-scale-bug-fix-is-jquery-mobile-using – Durai Amuthan.H Apr 27 '15 at 08:32
  • @Piwwoli - I have posted my answer containing Bug topics and workarounds. – Durai Amuthan.H Apr 27 '15 at 08:56

1 Answers1

1

You couldn't reproduce the bug in one of your sites in the latest iOS 8.3 But you could still reproduce the bug in some of your other sites.

From the comments you are using jQuerymobile.

some versions of jQuery mobile can be incompatbile with some versions of iOS Safari.

We can't completely rule out the possible bug in safari viewport scaling in some versions.But what we can do we can do a workaround to solve the problem.

Here is a one of the workaround to deal with scaling problem.

Here is a bug topic in jQuery forum

Here is a detailed article on how to solve the iPhone viewport scale bug.

It is always wise to have the latest jqueryMobile in your site as it possibly will have the fixes and workarounds that jQueryMobile encounters in the newer versions of browser.

Hope this helps.

Feel free to comment for any doubts.

Community
  • 1
  • 1
Durai Amuthan.H
  • 31,670
  • 10
  • 160
  • 241
  • 1
    I could not get the workaround to work just yet, but this seems like the most probable cause for my problem. Thank you! – Swiffy Apr 27 '15 at 08:58