O'Reilly logo

iPhone JavaScript Cookbook by Arturo Fernandez Montoro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Preventing scaling

By default, Safari allows you to zoom in and out of the page that is displayed inside the mentioned viewport. However, native applications don't allow this behavior by default. Keep reading to learn more about how to avoid it.

How to do it...

Once more, we're going to use a simple HTML line inside the<head> section:

<meta name="viewport" content="user-scalable=no" />

How it works...

The previous recipe showed how to set the width for the viewport, but this area can be managed through additional parameters. One of them is user-scalable, which controls whether the user can zoom or not. In this case, we're using the no value to indicate that scaling zooming is not allowed. Actually, this is the default feel for native applications. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required