Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you stop a web page from being zoomed from an iPhone?

Tags:

iphone

Some mobile web sites such as the BBC mobile website stop you zooming in on the main home page on an iPhone - how is this acheived. Is there a directive that has to be included in the HTMl code or something ?

like image 947
cyberbobcat Avatar asked Apr 16 '09 11:04

cyberbobcat


People also ask

How do I turn off Zoom on websites?

To disable the zooming option with the multi-touch gesture we can use surefox browser but still, a user can zoom in or out by double tapping on the screen. We can use the <meta> tag to disable zoom in and out on a mobile web page.

How do I turn off zoom in Safari?

In the Safari app on your Mac, choose Safari > Settings, click Websites, then click Page Zoom. Select all websites listed below Configured Websites, then click Remove to clear the list.

Why is my browser zoomed in on iPhone?

Your iPhone is stuck zoomed in because an accessibility feature called Zoom is turned on in Settings. Zoom makes it easier for people with low vision to use their iPhones by allowing them to zoom in on certain parts of the screen.


2 Answers

You just need to tell the iPhone not to let the user zoom, with a meta-tag:

<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>

This should still let your webpage rotate, but not zoom.

like image 86
David Wengier Avatar answered Oct 10 '22 05:10

David Wengier


It's because the width of the site is set to the native resolution of the iPhone display. Mobile Safari never actually zooms past 100% on any site, on a standard sized site say (1000px wide) it is zoomed out to begin with and you specify the zoom level when double tapping or using the pinch gesture.

To achieve the same effect use a max width on your site to match the resolution of the iPhone which is 320px.

In CSS this would be done like:

div#wrapper
{
  width: 320px;
}
like image 27
Shaun Bohannon Avatar answered Oct 10 '22 04:10

Shaun Bohannon