I'm developing an app for Chrome on a Microsoft Surface Pro 2 running Windows 8.1. Recently, the Chromium team decided they wanted to add the pinch-to-zoom gesture in Chrome for Windows 8, which is all and good. They did not, however, add a flag to disable this behavior in Chrome's settings for those few of us that don't want pinch-to-zoom functionality.
Now I'm left trying to disable the browser's default behavior by other means. The first thing I tried was to add this meta-tag:
<meta name="viewport" content="width=device-width, initial-scale=1.5, maximum-scale=1.5, user-scalable=no" />
It had no effect. I've also been trying to use the hammer.js touch library to disable the behavior with limited success; pinching sufficiently fast enough still zooms the page.
Does anyone know of a effective way to disable the pinch-to-zoom behavior on Chrome for Windows 8.1?
Enable viewport meta tag support by:
chrome://flags
(as suggested in comments above):
touchmove
eventspreventDefault
on them if you detect two touches.Note: Always preventing touchmove
would cause simple scroll to stop working
Unfortunately it is not possible to completely block, it seems.
Matyas' solution will work great until you start using one finger to scroll, and then put another finger down and pinch to zoom.
Calling preventDefault in this case causes the warning: "Ignored attempt to cancel a touchmove event with cancelable=false, for example because scrolling is in progress and cannot be interrupted."
And the pinch to zoom is not blocked.
This appears to be a bug.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With