The mobile device has been upgraded to IOS10 and found that its own Safari browser no longer recognizes Meta viewport . We used to use this tag to let the browser disable zooming. The apple~~ of Evil
Before the iOS10, it was all through.
<meta name="viewport" content="width=device-width,initial-scale=1.0, Maximum-scale=1.0,minimum-scale=1.0,user-scalable=no ">
To force the phone browser to be scaled, but safari no longer recognizes this meta tag after upgrading to IOS10. So you have to use JS to hack a bit:
To disable two-finger scaling:
Document.documentElement.addEventListener (' Touchstart ', function (event) {
if (Event.touches.length > 1) {
Event.preventdefault ();
}
}, false);
Disable Finger double-click Zoom:
var lasttouchend = 0;
Document.documentElement.addEventListener (' touchend ', function (event) {
var now = Date.now ();
if (now-lasttouchend <= 300) {
Event.preventdefault ();
}
Lasttouchend = Now;
}, false);
If in the IOS10 Safari set up viewport , in fact, double-click amplification is not in effect, so personally think the iOS10 on the better solution is set viewport first, and then use JS to disable the two-finger zoom, no longer set to disable double-click Scaling.
The author of this solution also gives a hint that if any of the child elements of the touch event stopPropagation is set to block event bubbling, it may still fail, and in iOS10 your input box font should not be less than 16px, Otherwise iOS might force the zoom in when the input box gets focus.
Original address: Http://stackoverflow.com/questions/37808180/disable-viewport-zooming-ios-10-safari
iOS double-click Page Zoom Disable