21

How can I disable zoom-in and zoom-out capability in responsive design pages while using iPad, iPhone and/or some other smartphone.

Is there any way to control it?

ale
  • 6,369
  • 7
  • 55
  • 65
Mo.
  • 26,306
  • 36
  • 159
  • 225

3 Answers3

56

Create a META viewport tag, and set the user-scalable property to 'no', like this:

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

Updated answer:-

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
Mo.
  • 26,306
  • 36
  • 159
  • 225
Adam Stanley
  • 1,875
  • 1
  • 15
  • 16
0

This pretty much discriminates against anyone over 30, suppressing zoom just forces them to use reading glasses. Which may be your intent.

One of the workarounds for such users is to use RDP or VNC to view a desktop browser and "pinch" the view of that.

Question should maybe read "how to disable" or "how to suppress". You should of course discern your devices using the user agent string.

mckenzm
  • 1,545
  • 1
  • 12
  • 19
  • Thank you very much for your advice, Just changed the question title – Mo. Mar 30 '16 at 05:50
  • 1
    I'm 45 and I can read StackOverflow's tiny text. Isn't this what accessibility settings on your phone are for? To override the page specially for you, not force a designer into bloated code for just a few people? – pathfinder May 20 '17 at 01:26
  • "People above 30 cannot read text on mobile", is pretty discriminating assumption in itself. I am above 30 and I can read SMS on normal font size from 4 feet away. – Ejaz Jul 16 '18 at 05:59
  • SMS, but try the fine print on Amazon, then try zooming in and having the page adapt and move the fields of importance to you. Basically I am saying the pages should be standardised and the device should cope. There are some shocking sites out there, as bad as WAP days. – mckenzm Jul 17 '18 at 11:35
0

To Disable Zoom Please Add this Script

<script type="text/javascript">
document.addEventListener('touchmove', function (event) {
  if (event.scale !== 1) { event.preventDefault(); }
}, { passive: false });
</script>
Piotr Labunski
  • 1,638
  • 4
  • 19
  • 26
Prem
  • 153
  • 1
  • 7