Friday, October 16, 2026
HomeiOS Developmentjavascript - 'user-scalable=no' just isn't engaged on Safari

javascript – ‘user-scalable=no’ just isn’t engaged on Safari

[ad_1]

I attempted to make use of “user-scalable=no” within the meta tag to disable zooming on cellular webpage, but it surely’s not engaged on Safari. Due to this fact I attempted to make use of javascript (code beneath) to manage it, but it surely additionally failed. Is there one other technique to disable zooming of Safari?

doc.addEventListener('touchstart', (occasion) => {
if (occasion.touches.size > 1) {
occasion.preventDefault();
}
}, { passive: false }); 

let lastTouchEnd = 0;
doc.addEventListener('touchend', (occasion) => {
const now = (new Date()).getTime();
if (now - lastTouchEnd <= 300) {
occasion.preventDefault();
}
lastTouchEnd = now;
}, false);
}```

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments