Disable zoom on websites for iOS 12+

时间:2019-01-07 13:19:55

标签: javascript ios mobile gesture

I am looking now for days for a working code to disable the iOS zoom for websites.

I also found this: disable viewport zooming iOS 10+ safari?

The fixes may work for iOS 10 but seems not to work for iOS 12. I already found a website where the zoom is disabled successfully but I am not able to find out how they have done it.

I know that Apple removed the possibility to disable the zoom via viewport-meta tag but there must be a workaround to disable it for a website.

For our website its essential that the zoom is disabled or that the zoom does not trigger a resize event. Any ideas how to solve this?

What I have tried already is e.g. to prevent touchmove / ontouchstart / gesturestart ... nothing of them worked.

1 个答案:

答案 0 :(得分:0)

可以通过在元素上添加空点击事件监听器来禁用双击缩放。

禁用捏缩放功能很麻烦,如果event.touches> 1,则必须防止touchstart事件,但这仅在页面没有动量滚动时有效

See my answer