The android:
Add meta tags to the HTML file of the entry file
<meta
content="Width = device - width, initial - scale = 1.0, the maximum - scale = 1.0, user - scalable = 0;"
name="viewport"
/>
Copy the code
Ios: ios has its own JS event control zoom, disable the default behavior of the event
document.documentElement.addEventListener(
"touchstart".function(event) {
if (event.touches.length > 1) { event.preventDefault(); }},false
);
var lastTouchEnd = 0;
document.documentElement.addEventListener(
"touchend".function(event) {
var now = Date.now();
if (now - lastTouchEnd <= 300) {
event.preventDefault();
}
lastTouchEnd = now;
},
false
);
document.addEventListener("gesturestart".function(event) {
event.preventDefault();
});
Copy the code