Auto-zoom on orientation change in iOS 7 - html

I had a web page that worked perfectly well until Apple came out with iOS 7 today and it broke the layout when screen orientation is changed.
Basically, when I have focus on a text area and rotate the screen to landscape view, the entire page zooms in. If focus is taken out of the text area and turned back to Portrait, things are back normal.
Rotation also works well when the text areas does not have focus.
I already have the following meta-tag in place (to ensure we block zooming):
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0;;">
Any ideas what's causing this awkward behavior?

What do you exactly mean with "broken layout"?
I would like to see a screenshot!
The only thing I saw in my websites, is that the form elements are getting out of the view, as the content lenght is changeing. Im talking about a responsive desing ofc.
Maybe there is a JS to fix this...
Im not preventing the zoom of a website, unless it is a tool that simulates an app
or the customer wants it so. ;)
But im preventing the standard zoom when focusing form elements with jQuery, or JS if jQuery is not in use!
$("input[type=text], textarea, select").focus(function(){
$('head meta[name=viewport]').remove();
$('head').prepend('<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0;" />');
}).blur(function(){
$('head meta[name=viewport]').remove();
$('head').prepend('<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=1;" />');
});

Related

Hide Safari's default elements like headerbar and status bar in iphone devices without scrolling the page

I'm working on a web application where the layout has three sections like Header, Middle Section and Footer. The Layout height is fix as per device screen and scroll will be in middle section only if the content will have more height than middle section's height. So I've applied this meta tags for hiding safari's default elements:
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">
<meta name="apple-mobile-web-app-title" content="BestForming">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
But after applying this and when I'm checking in real device I can't find any change in layout it's still display the default elements.
Thanks In Advance...
These metatags are for progressive web apps. You can see the change of these tags only when you do the following steps,
Click options and select, 'Add to Homescreen'.
Provide a name and save.
Exit the browser
Click the new icon which is now available in the menu
Now you can see your web app in home screen without the address bar.

Meta tag? form field zooms on focus but does not un-zoom when on focus out on mobile devices?

I have a website that I am trying to make mobile friendly. When I get to my forms though when the textbox is selected the screen zooms in when you're done it does not zoom back out. I do not think this is my CSS that is doing this I have a feeling it involves the way you set up your meta tags. Is there a way I can adjust my meta tags to not do that zoom in since its not zooming out? Or have it at least zoom out once the focus is lost.
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
If you wanted to remove zooming on the page altogether, you could try adding user-scalable=0 to your viewport tag, like so;
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
But this may not be ideal. From what I can gather, another way to prevent this would be setting the input text of the form in question to be above a certain size, to prevent zooming on the form specifically. For most iOS/mobile devices, that size seems to be around 16px, although this would likely vary between devices.
input {
font-size: 16px;
}

Responsive design: viewport isn't being applied properly

Here is my website, www.offergrind.com
I made it fully non-responsive but the problem is that if we view it in mobile it is displaying the top left part.
Is there any code such as
<meta name="viewport" content="width=SITE_MIN_WIDTH, initial-scale=1, maximum-scale=1">
What should i do to make the website to display fit in mobile view ?
Start with this. At minimal, it will make your website fit the device, but everything will be sized down.
<meta name="viewport" content="width=device-width">
You should also look in CSS pre-processors, I was blown away by how many CSS files you reference.
I would get rid of the viewport meta tag altogether. If your website was not designed to be responsive, it will only make things worse. See this for more:
Stop using the viewport meta tag (until you know how to use it)
Use the below meta tag for your website
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
The meta tag above explains everything:
width="device-width" width of the website is equal to device width
initial-scale=1.0 means the website will not scale to fit the device screen
when we set minimum-scale=1.0, maximum-scale=1.0 and user-scalable=0 means user will not be able to scale the webpage (it will turn off pinch-zooming by setting maximum-scale to 1, or using user-scalable=no. )

How to set initial scale so that my mobile website fits on the screen

I'm wondering about how to set the 'intial-scale' so that on various devices the width of the site fits the width of the screen when you 1st load it.
My website
http://bam.net16.net/BAM/
It works just fine on regular browsers but I had weird behaviour with text inflation + iframe being half blank on mobile device browsers.
The viewport meta tag is helping me. This is working ok now.
<meta name="viewport" content="width=device-width" />
<meta name="viewport" content="width=240, height=320, user-scalable=yes, initial-scale=0.3, maximum-scale=1.0, minimum-scale=0.3" />
<meta name="apple-mobile-web-app-capable" content="yes" />
At the moment if the initial scale is big and the site starts out zoomed in then the portion of the iframe within the site that is off screen is never drawn when you zoom out. If have it set with a small initial scale so that it starts way zoomed out you can zoom in and it all works OK.
<meta name="apple-mobile-web-app-capable" content="yes" />
What fixed my problems was actually removing all those meta tags above and adding this line to my CSS:
html * {max-height:1000000px;}
This fixes the font inflation/boosting that was making my website not work on mobile in the 1st place.
Without any of those viewport meta tags, all browsers I tested* will automatically zoom to the page width.
*default, Chrome and Firefox on android.

iOS Text & Images Blurred when using webkit-overflow-scrolling: touch

webkit-overflow-scrolling: touch;
This works perfectly in terms of scrolling, but it blurs the text and images noticeably in the <DIV> with overflow: scroll applied. I have tried this on 3 different iPads with iOS5.
The easing/bounce algorithm native from Apple are much better than any JS equivalent, so I would like to start using this new feature! It is even more noticeable with the font I am required to use.
Here is a demo you can try from an iPad w/ iOS5:
http://sseeger.drivehq.com/test.htm [Stark, NO webkit-overflow-scrolling: touch;]
http://sseeger.drivehq.com/test2.htm [Blurry, webkit-overflow-scrolling: touch;]
The issue you were seeing is due to the default zooming of the ipad. Paul's response was on the right track but also unnecessarily disables user zooming. You just need to correctly set the initial scale and width of your screen.
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
For my test case, try opening these two pages on an ipad:
http://www.jasonbuckboyer.com/playground/ios/overflow_scrolling/blurred.html (Blurred)
http://www.jasonbuckboyer.com/playground/ios/overflow_scrolling/not_blurred.html (Not Blurred)
-webkit-perspective: 0;
worked for me.
It doesn't seem to be blurring in the iOS simulator. I can see why it would be blurry though with webkit-overflow-scrolling being used, as it needs to render the content differently when there is momentum involved (at least that's what I think).
As for a solution, you will have to wait for Apple to address the issue (if it even is affecting a wide audience).
Try adding the following meta tag to your header section of your page.
<meta name="viewport" content="width = device-width, initial-scale = 1.0, user-scalable = "no"/>