Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable double tap zoom on Safari iOS 13 +

Tags:

html

ios

safari

web

How can we disable "double tap to zoom" on Safari iOS 13+ mobile?

Sometimes it zooms, sometimes not. i feel it may only work on specific HTML-elements.

And i read that "double tap to zoom" should be disabled on iOS 13 by default and only pinch-zoom should work, but that's not the case.

like image 258
oygen Avatar asked Jan 14 '20 10:01

oygen


People also ask

How do I stop Safari from zooming in IOS?

Open the Settings app on the iPhone or iPad. Scroll down and choose the Safari browser from Settings. From Safari Settings, select the Page Zoom Safari option. Within the window, tap to select the Zooming level.

How do I turn off double tap Zoom on Apple?

To turn off Zoom, double-tap the screen with three fingers or use accessibility shortcuts. On an iPhone with Display Zoom, you can see larger onscreen controls. Go to Settings > Display & Brightness > View, then turn on Display Zoom.


2 Answers

You can add the below meta tag to stop zooming on ios devices.

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

a css fix:

body{
    touch-action: manipulation;
}

Hope is helps.

like image 181
Kevin Avatar answered Oct 10 '22 11:10

Kevin


This works in Safari iOS 15

document.ondblclick = function(e) {
    e.preventDefault();
}
like image 23
Ryan Dantzler Avatar answered Oct 10 '22 12:10

Ryan Dantzler